Tensorflow tf.log()

import tensorflow as tf

tensor = tf.constant([[1.0,2.0,3.0],[1.0,2.0,3.0],[1.0,2.0,3.0]], dtype=tf.float32)
tensor_log = tf.log(tensor)
with tf.Session() as sess: 
    print("tensor:")
    print(sess.run(tensor))
    print("tf.log(tensor):")
    print(sess.run(tensor_log))

输出:

tensor:
[[1. 2. 3.]
 [1. 2. 3.]
 [1. 2. 3.]]
tf.log(tensor):
[[0.        0.6931472 1.0986123]
 [0.        0.6931472 1.0986123]
 [0.        0.6931472 1.0986123]]
发布了90 篇原创文章 · 获赞 9 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/wangwenjie1997/article/details/104574864