使用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
人工智慧遇見磐創