标签:import pre ref tensor com variable highlight info name
import tensorflow as tf # tensorflow还支持变量的定义 var = tf.Variable(3) print(var) # <tf.Variable ‘Variable:0‘ shape=() dtype=int32_ref> # 也可以指定类型和名字 var1 = tf.Variable(4, name="mmp", dtype=tf.float64) print(var1) # <tf.Variable ‘mmp:0‘ shape=() dtype=float64_ref> # 关于参数shape,表示变量是几维的 var2 = tf.Variable([1, 2, 3]) print(var2) # <tf.Variable ‘Variable_1:0‘ shape=(3,) dtype=int32_ref> var3 = tf.Variable([[1, 2, 3], [4, 5, 6]]) print(var3) # <tf.Variable ‘Variable_2:0‘ shape=(2, 3) dtype=int32_ref>
标签:import pre ref tensor com variable highlight info name
原文地址:https://www.cnblogs.com/traditional/p/9339290.html