def setup_output(self, x):
"""
Setup output tensor
"""
x_max = K.max(x, axis=1)
x_max = K.flatten(x_max)
z = K.dot(x_max, self.w_proj_to_z) #+ self.b_proj_to_z
hidden = K.dot(z, self.weights[0]) + self.biases[0]
hidden = K.reshape(hidden, shape=(self.input_channels,
self.hidden_dim))
output = K.dot(hidden, self.weights[1]) + self.biases[1]
self.output = K.reshape(output, (self.num_filters, self.input_channels,
*self.output_shape))
return self.output
评论列表
文章目录