摘要: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) lr=0. 阅读全文
posted @ 2018-01-26 21:37 一个处女座的程序猿 阅读(280) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np W = tf.Variable([[2,1,8],[1,2,5]], dtype=tf.float32, name='weights') b = tf.Variable([[1,2,5]], dtype=tf.float32, name='biases') init= tf.global_variabl... 阅读全文
posted @ 2018-01-25 22:05 一个处女座的程序猿 阅读(192) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np W = tf.Variable(np.arange(6).reshape((2, 3)), dtype=tf.float32, name="weights") b = tf.Variable(np.arange(3).reshape((1, 3)), dtype=tf.float32, name="biase... 阅读全文
posted @ 2018-01-25 21:58 一个处女座的程序猿 阅读(164) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # number 1 to 10 data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) def compute_accuracy(v_xs, v_ys... 阅读全文
posted @ 2018-01-24 23:17 一个处女座的程序猿 阅读(245) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf from sklearn.datasets import load_digits #from sklearn.cross_validation import train_test_split from sklearn.model_selection import train_test_split from sklearn.preprocessing... 阅读全文
posted @ 2018-01-24 18:35 一个处女座的程序猿 阅读(227) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # number 1 to 10 data mnist = input_data.read_data_sets('MNIST_data', one_hot=True) def add_layer(inputs, in_size... 阅读全文
posted @ 2018-01-24 16:45 一个处女座的程序猿 阅读(204) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np def add_layer(inputs, in_size, out_size, n_layer, activation_function=None): # add one more layer and return the output of this layer layer_n... 阅读全文
posted @ 2018-01-24 15:47 一个处女座的程序猿 阅读(630) 评论(0) 推荐(0) 编辑
摘要: import tensorflow as tf import numpy as np import matplotlib.pyplot as plt def add_layer(inputs, in_size, out_size, activation_function=None): Weights 阅读全文
posted @ 2018-01-22 23:41 一个处女座的程序猿 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #TF:TF定义两个变量相乘之placeholder先hold类似变量+feed_dict最后外界传入值 import tensorflow as tf input1 = tf.placeholder(tf.float32) #TF一般只能处理float32的数据类型 input2 = tf.placeholder(tf.float32) #ouput = tf.mul(input1,... 阅读全文
posted @ 2018-01-22 16:22 一个处女座的程序猿 阅读(129) 评论(0) 推荐(0) 编辑
摘要: #TF:Tensorflow定义变量+常量,实现输出计数功能 import tensorflow as tf state = tf.Variable(0, name='Parameter_name_counter') #print(state.name) one = tf.constant(1) new_value = tf.add(state, one) update = ... 阅读全文
posted @ 2018-01-22 15:56 一个处女座的程序猿 阅读(898) 评论(0) 推荐(0) 编辑