tensorflow学习
sxl545
图像处理,OpenCV,机器学习
展开
-
Tensorflow安装成功了,迈出第一步
花了一晚上的时间,终于安装成功了用《TensorFlow-实战Google深度学习框架》2.3中的例子测试如下原创 2018-06-21 23:04:13 · 191 阅读 · 0 评论 -
莫凡Tensorflow视频学习005-添加层
import tensorflow as tfdef add_layer(inputs, in_size, out_size, activation_function=None): Weights = tf.Variable(tf.random_normal([in_size, out_size])) biases = tf.Variable(tf.zeros(1, out_s...原创 2018-07-15 16:46:26 · 618 阅读 · 0 评论 -
《TensorFlow-实战Google深度学习框架》3.4.5 完整神经网络样例程序
import tensorflow as tf#Numpy是一个科学计算的工具包,这里通过Numpy工具包生成模拟数据集from numpy.random import RandomState#定义训练数据batch的大小batch_size = 8#定义神经网络的参数w1 = tf.Variable(tf.random_normal([2, 3], stddev = 1, see...原创 2018-07-11 22:46:05 · 551 阅读 · 1 评论 -
莫凡Tensorflow视频学习003-Variable初步了解
import tensorflow as tf#state = tf.Variable(0, name = 'counter')state = tf.Variable(0)one = tf.constant(1)new_value = tf.add(state, one)update = tf.assign(state, new_value)init = tf.initializ...原创 2018-06-28 21:35:29 · 226 阅读 · 0 评论 -
莫凡Tensorflow视频学习002-Session的两种用法
import tensorflow as tfmatrix1 = tf.constant([[3,3]]) #create a 1*2 matrixmatrix2 = tf.constant([[2], [2]]) #cteate a 2*1 matrixproduct = tf.matmul(matrix1, matrix2); ...原创 2018-06-28 20:29:18 · 253 阅读 · 0 评论 -
莫凡Tensorflow视频学习001 一元线性函数y = w *x + b
import tensorflow as tfimport numpy as np#create datax_data = np.random.rand(100).astype(np.float32)y_data = x_data * 0.1 + 0.3###create tensorflow structure start###weight = tf.Variable(tf.ra...原创 2018-06-27 21:14:29 · 408 阅读 · 0 评论 -
《TensorFlow-实战Google深度学习框架》3.4.4通过tensorflow训练神经网络模型
Tensorflow提供了placeholder机制用于提供输入数据。placeholder相当于定义了一个位置,这个位置的数据在程序运行时再指定。import tensorflow as tfw1 = tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))w2 = tf.Variable(tf.random_normal([3, 1]...原创 2018-07-02 23:03:15 · 164 阅读 · 0 评论 -
莫凡Tensorflow视频学习004-传入值placeholder feed-dict
import tensorflow as tfinput1 = tf.placeholder(tf.float32)input2 = tf.placeholder(tf.float32)output = tf.multiply(input1, input2)#视频中使用的tf.mul(input1, input2)是旧版本,不能用with tf.Session() as sess:...原创 2018-06-30 21:44:18 · 169 阅读 · 0 评论 -
《TensorFlow-实战Google深度学习框架》3.4.3 神经网络参数与tensorflow变量
import tensorflow as tf#声明w1,w2两个变量,并且使用正态分布随机数初始化这两个变量#seed的设置可以保证每次运行的结果是一样的w1 = tf.Variable(tf.random_normal((2,3), stddev=1, seed=1)) #2*3矩阵w2 = tf.Variable(tf.random_normal((3,1), stddev=1, ...原创 2018-06-30 18:31:37 · 146 阅读 · 0 评论