def get_output(self, X):
convnet_output = 0
if self.has_convnet:
# Hack: input_masked is a 2D matrix instead of a 4D tensor, but we have all the information to fix that.
input_4D = X.reshape((-1, self.nb_channels) + self.image_shape)
convnet_output = self.convnet.get_output(input_4D) # Returns the convnet's output preactivation.
# This will generate a matrix of shape (batch_size, nb_kernels * kernel_height * kernel_width).
convnet_output = convnet_output.flatten(2)
fullnet_output = 0
if self.has_fullnet:
fullnet_output = self.fullnet.get_output(X) # Returns the fullnet's output preactivation.
output = convnet_output + fullnet_output
# TODO: sigmoid should be applied here instead of within loss function.
return output
评论列表
文章目录