tensorflow中theano的categorical_crossentropy函数的等价性 [英] equivalence of categorical_crossentropy function of theano in tensorflow
本文介绍了tensorflow中theano的categorical_crossentropy函数的等价性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下 tensorflow 中的 theano 函数的等效函数可能是什么?
What might be the equivalent function of the following theano function in tensorflow?
Theano.tensor.nnet.categorical_crossentropy(o, y)
推荐答案
对于二维张量的二维张量:
For 2D tensors with probability distributions in the 2nd dimension:
def crossentropy(p_approx, p_true):
return -tf.reduce_sum(tf.multiply(p_true, tf.log(p_approx)), 1)
这篇关于tensorflow中theano的categorical_crossentropy函数的等价性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文