摘要:
import tensorflow as tfimport numpy as np #使用numpy生成随机点x_data = np.random.rand(100)y_data = x_data*0.1 + 0.2 #构造一个线性模型b = tf.Variable(0.0)k = tf.Varia 阅读全文
摘要:
import tensorflow as tf #Fetch input1 = tf.constant(1.0)input2 = tf.constant(3.0)input3 = tf.constant(5.0) add = tf.add(input2,input3)mul = tf.multipl 阅读全文
摘要:
import tensorflow as tf x = tf.Variable([1,2])a = tf.constant([3,3])#增加一个减法opsub = tf.subtract(x,a)add = tf.add(x,sub) #初始化所有变量init = tf.global_variab 阅读全文
摘要:
import tensorflow as tf #创建一个常亮m1m1 = tf.constant([[3,3]])#创建一个常量m2m2 = tf.constant([[2],[3]])#矩阵相乘product = tf.matmul(m1,m2)print(product) #定义一个会话,启动 阅读全文