tensorflow练习
Monk丶
编程小白
展开
-
Tensorflow练习第一弹:线性回归
预测线性回归方程:y = 0.1*x + 0.3# -*- coding: utf-8 -*-"""Created on Tue May 11 11:56:47 2021@author: monastic"""生成训练数据import tensorflow as tfimport numpy as np#creat datax_data = np.random.rand(100).astype(np.float32)y_data = x_data*0.1+0.3create原创 2021-05-12 12:05:18 · 63 阅读 · 0 评论 -
Tensorflow练习第二弹:session控制会话
# -*- coding: utf-8 -*-"""Created on Wed May 12 12:18:34 2021@author: monastic"""import tensorflow as tfmatrix1 = tf.constant([[3,3]])matrix2 = tf.constant([[2], [2]])product = tf.matmul(matrix1,matrix2) #matrix multipl原创 2021-05-12 13:42:14 · 78 阅读 · 0 评论 -
Tensorflow练习第三弹:Variable变量
# -*- coding: utf-8 -*-"""Created on Wed May 12 13:44:21 2021@author: monastic"""import tensorflow as tfstate = tf.Variable(0,name = 'counter') #定义state为变量,初始值为0,名字为counterprint(state.name)one = tf.constant(1)new_value = tf.add(state, one)原创 2021-05-12 13:59:01 · 50 阅读 · 0 评论 -
Tensorflow练习第四弹:placeholder传入值
# -*- coding: utf-8 -*-"""Created on Wed May 12 13:59:48 2021@author: monastic"""import tensorflow as tfinput1 = tf.placeholder(tf.float32) #tensorflow大部分只能处理float32类型数据input2 = tf.placeholder(tf.float32)output = tf.multiply(input1,input2)wi原创 2021-05-12 14:10:20 · 72 阅读 · 0 评论 -
Tensorflow练习第五弹:搭建神经网络
Tensorflow练习第四弹:搭建神经网络Momentum degrentAdaGradRMSPropAdam又快又好# -*- coding: utf-8 -*-"""Created on Mon May 17 09:49:58 2021@author: monastic"""import tensorflow as tfimport numpy as np配置网络层# in_size=输入向量的维度,即一个神经元的权值个数#out_size=这层神经元的个数def原创 2021-05-18 10:27:40 · 113 阅读 · 0 评论 -
Tensorflow练习第六弹:神经网络结果可视化
神经网络可视化# -*- coding: utf-8 -*-"""Created on Mon May 17 09:49:58 2021@author: monastic"""import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt# in_size=输入向量的维度,即一个神经元的权值个数#out_size=这层神经元的个数def add_layer(inputs,in_size,out_si原创 2021-05-18 10:48:23 · 215 阅读 · 0 评论 -
Tensorflow练习第七弹:神经网络可视化tensorboard 1
神经网络可视化# -*- coding: utf-8 -*-"""Created on Mon May 17 09:49:58 2021@author: monastic"""import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt# in_size=输入向量的维度,即一个神经元的权值个数#out_size=这层神经元的个数def add_layer(inputs,in_size,out_si原创 2021-05-18 11:32:33 · 160 阅读 · 0 评论