def energy(self, v, h):
"""Energy of system given visible unit and hidden values."""
vbias_term = tf.matmul(v, tf.expand_dims(self.params['bvis'], 1))
hidden_term = tf.matmul(h, tf.expand_dims(self.params['bhid'], 1))
Wx = tf.matmul(v, self.params['W'])
hWx = tf.batch_matmul(tf.expand_dims(Wx, 1), tf.expand_dims(h, 2))
return -tf.squeeze(hidden_term) - tf.squeeze(vbias_term) - tf.squeeze(hWx)
评论列表
文章目录