tensorflow里面的变量表示,需要使用特定的语法进行.如果想构造一个行(列)向量,需要调用Variable函数进行.对两个变量进行操作,也要调用相应的函数. import tensorflow as tf w = tf.Variable([[0.5,1.0]]) x = tf.Variable([[2.0],[1.0]]) #w*x y = tf.matmul(w,x) 以上是构造一个行向量,一个列向量,并让两者相乘.y的结果: Tensor("MatMul_2:0", shap…
TensorFlow学习笔记2-性能分析工具 性能分析工具 在spyder中运行以下代码: import tensorflow as tf from tensorflow.python.client import timeline #构造计算图 x = tf.random_normal([1000, 1000]) y = tf.random_normal([1000, 1000]) res = tf.matmul(x, y) #运行计算图, 同时进行跟踪 with tf.Session() as…