def __call__(self, *args): if self.get_dim_in() is None: self.infer_shape(*map(lambda x: T.get_shape(x)[1:], args)) if self.is_initialized(): self.initialize() else: raise Exception('Not enough information to initialize network') return self.forward(*args)
def _statistic(self, stat): weights = Stats.X(self.weights) stats = stat(self.tensor) out = T.core.tensordot(weights, stats, 1) out.set_shape(T.get_shape(stats)[1:]) return out