def _compute_specific(self, predicted, targets):
# Generate random predictions with equal probabilities
random = tf.multinomial(logits=tf.log([[10.] * self._num_classes]),
num_samples=tf.shape(targets)[0])
# Output prediction as ratio of matches
eq = tf.equal(x=random, y=tf.cast(targets, tf.int64))
return tf.reduce_mean(tf.cast(eq, tf.float32))
评论列表
文章目录