使用TensorFlow v2张量的一个简单的“hello world”示例
import tensorflow as tf# 创建一个张量hello = tf.constant("hello world")print hello
Output:
tf.Tensor(hello world, shape=(), dtype=string) # 访问张量的值,调用numpy()print hello.numpy()
output:
hello world
人工智能遇见磐创