![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
有梦想的咸鱼_
知行合一
展开
-
Tensorflow样例
(一) import tensorflow as tf import numpy as np import matplotlib.pyplot as plt train_X=np.linspace(-1,1,100) train_Y=2*train_X+np.random.randn(*train_X.shape)*0.3 plt.plot(train_X,train_Y,'ro',label=...原创 2019-12-01 16:21:59 · 140 阅读 · 0 评论 -
Mnits手写体识别
import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_data def init_weights(shape): return tf.Variable(tf.random_normal(shape, stddev=0.01)) def model(X...原创 2019-11-26 20:13:53 · 240 阅读 · 0 评论 -
ubuntu系统下最简单快捷的利用conda安装TensorFlow-gpu
之所以是最简单快捷因为用conda安装TensorFlow它会自己安装cuda和cudnn,如果自己配版本的 话会非常麻烦 1.直接用conda创建一个虚拟环境 conda create -n TensorFlow python=3.6 TensorFlow是环境名称,可以随便改 python版本根据你自己要安装的TensorFlow版本来决定。 这样一个虚拟环境就创好了,然后就可以在环境里为所欲...原创 2019-09-04 21:54:04 · 445 阅读 · 0 评论 -
Tensorflow 简单神经网络
带有tensorflow的jupyter notebook 就可以运行 import numpy as np import tensorflow as tf import matplotlib.pyplot as plt def addlayer(inputs, insize, outsize, activefunction=None): Weight = tf.Variable(tf...转载 2019-09-26 16:23:28 · 127 阅读 · 0 评论 -
Tensorflow中最简单 mnist 手写体识别
机器学习中mnist相当于普通语言中的hello,world 使用softmax 函数实现 接下来就来实现它(我是在jupyter notebook上实现的) #载入数据集,直接调用就行 from tensorflow.examples.tutorials.mnist import input_data mnist=input_data.read_data_sets("MNIST_data/",o...原创 2019-09-28 11:32:17 · 242 阅读 · 0 评论 -
Tensorflow计算一个五层神经网络带L2正则化的损失函数
在复杂神经网络中,如果加入简单的正则化,那么可能导致loss的定义过长,可读性很差。现在使用tensorflow中提供的集合(collection)将正则化加入到集合中进行优化 import tensorflow as tf #将L2正则化损失加入到集合中 def get_weight(shape,lambda1): var=tf.Variable(tf.random_normal(sh...原创 2019-09-30 09:45:51 · 757 阅读 · 0 评论 -
Tensorflow学习笔记——操作MNIST数据集
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # MNIST 数据集相关的常数 # 输入层的节点数,对于MNIST数据集,这个就等于图片的像素 INPUT_NODE = 784 # 输出层的节点数,这个等于类别的数目,...原创 2019-09-30 10:04:01 · 234 阅读 · 0 评论