在 TensorFlow 2.10 中,你可以使用 print
函数或者 tf.print
函数来查看张量的值。例如:
import tensorflow as tf
# 定义一个张量
x = tf.constant([[1, 2, 3], [4, 5, 6]])
# 使用 print 函数查看 x 的值
print(x)
# 使用 tf.print 函数查看 x 的值
tf.print(x)
在 TensorFlow 2.10 中,你可以使用 print
函数或者 tf.print
函数来查看张量的值。例如:
import tensorflow as tf
# 定义一个张量
x = tf.constant([[1, 2, 3], [4, 5, 6]])
# 使用 print 函数查看 x 的值
print(x)
# 使用 tf.print 函数查看 x 的值
tf.print(x)