cross_entropy 中的 reduce_mean

Notice code in file: https://github.com/GoogleCloudPlatform/tensorflow-without-a-phd/blob/master/tensorflow-mnist-tutorial/mnist_1.0_softmax.py


# cross-entropy
# log takes the log of each element, * multiplies the tensors element by element
# reduce_mean will add all the components in the tensor
# so here we end up with the total cross-entropy for all images in the batch
cross_entropy = -tf.reduce_mean(Y_ * tf.log(Y)) * 1000.0  # normalized for batches of 100 images,
# *10 because  "mean" included an unwa ... ... 
评论:
  • [#{{item.num}}] {{item.post.nickname}}

    {{item.post.textarea}}

图文信息
发布者 inksci
更新时间 2020-03-20 21:06:18
访问数 12
全部 全部文章

墨之科技,版权所有 © Copyright 2017-2027

湘ICP备14012786号     邮箱:ai@inksci.com