摘要:
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... 阅读全文
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True) 阅读全文
摘要:
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 阅读全文
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True) 阅读全文
摘要:
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=Tru 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文