def get_output_for(self, input, **kwargs): if input.ndim > 2: # if the input has more than two dimensions, flatten it into a # batch of feature vectors. input = T.flatten(input, 2) activation = T.dot(input, self.W) if self.b is not None: activation = T.broadcast('+', activation , T.dimshuffle(self.b, 'x', 0), 'xx,1x') return self.nonlinearity(activation)
def get_output_for(self, input, **kwargs): conved = self.convolve(input, **kwargs) if self.b is None: activation = conved elif self.untie_biases: activation = conved + T.shape_padleft(self.b, 1) else: activation = conved + T.dimshuffle(self.b, ('x', 0) + ('x',) * self.n) return self.nonlinearity(activation)