def get_density_probs(self):
q = tf.matmul(self._input_layer, tf.transpose(self._W)) + self._b
probs = tf.reciprocal(1 + tf.exp(-q)) # [batchsize, num_nodes]
log_probs = tf.map_fn(lambda x: self._grid_log_probs(x), probs) # [batchsize, gridlen]
return tf.exp(log_probs) / tf.reduce_sum(tf.exp(log_probs), axis=range(1,len(self._num_classes)+1), keep_dims=True)
评论列表
文章目录