摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=True) # 批次大小 batch_size = 64 # 计算一个周期一共有多少个批次 n_b... 阅读全文
posted @ 2019-09-28 23:54
刘文华
阅读(213)
评论(0)
推荐(0)
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True) 阅读全文
posted @ 2019-09-28 23:34
刘文华
阅读(168)
评论(0)
推荐(0)
摘要:
Iter 0,Testing Accuracy 0.9451,Training Accuracy 0.94643635 Iter 1,Testing Accuracy 0.9529,Training Accuracy 0.9566909 Iter 2,Testing Accuracy 0.96,Tr 阅读全文
posted @ 2019-09-28 23:32
刘文华
阅读(175)
评论(0)
推荐(0)
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True) 阅读全文
posted @ 2019-09-28 23:31
刘文华
阅读(256)
评论(0)
推荐(0)
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=Tru 阅读全文
posted @ 2019-09-28 23:25
刘文华
阅读(186)
评论(0)
推荐(0)
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=True) # 批次大小 batch_size = 64 # 计算一个周期一共有多少个批次 n_b... 阅读全文
posted @ 2019-09-28 23:23
刘文华
阅读(763)
评论(0)
推荐(0)
摘要:
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # numpy生成200个随机点 x_data = np.linspace(-0.5,0.5,200)[:,np.newaxis] noise = np.random.normal(0,0.02,x_data.shape) y_data = n... 阅读全文
posted @ 2019-09-28 22:58
刘文华
阅读(362)
评论(0)
推荐(0)
摘要:
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt x_data = np.random.rand(100) noise = np.random.normal(0,0.01,x_data.shape) y_data = x_data*0.1 + 0.2 + noise plt.scatter(x_da 阅读全文
posted @ 2019-09-28 22:53
刘文华
阅读(178)
评论(0)
推荐(0)
摘要:
import tensorflow as tf # Fetch:可以在session中同时计算多个tensor或执行多个操作 # 定义三个常量 input1 = tf.constant(3.0) input2 = tf.constant(2.0) input3 = tf.constant(5.0) # 加法op add = tf.add(input2,input3) # 乘法op mul = tf 阅读全文
posted @ 2019-09-28 22:43
刘文华
阅读(205)
评论(0)
推荐(0)
摘要:
import tensorflow as tf # 定义一个变量 x = tf.Variable([1,2]) # 定义一个常量 a = tf.constant([3,3]) # 减法op sub = tf.subtract(x, a) # 加法op add = tf.add(x,sub) # 所有变量初始化 init = tf.global_variables_initializer() wit 阅读全文
posted @ 2019-09-28 22:40
刘文华
阅读(137)
评论(0)
推荐(0)
摘要:
import tensorflow as tf # 创建一个常量 m1 = tf.constant([[3,3]]) # 创建一个常量 m2 = tf.constant([[2],[3]]) # 矩阵乘法op product = tf.matmul(m1, m2) print(product) # 定义会话 sess = tf.Session() # 调用sess中的run方法来执行矩阵乘法op 阅读全文
posted @ 2019-09-28 22:38
刘文华
阅读(268)
评论(0)
推荐(0)