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]]