
深度学习TensorFlow
沐风的程序人生
程序人生!
展开
-
简单线性拟合
import tensorflow as tf import numpy as np x_data = np.random.rand(100) y_data = x_data*0.6 + 0.8 # 定义变量 k = tf.Variable(tf.zeros([1, 1])) b = tf.Variable(tf.zeros([1, 1])) y = k * x_data + b # 定义...原创 2019-06-17 15:36:31 · 777 阅读 · 0 评论 -
tensorflow实现非线性拟合
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt x_data = np.linspace(-0.5, 0.5, 200)[:, np.newaxis] # 使得维度为[200, 1] noise = np.random.normal(0, 0.02, x_data.shape) # 维度为...原创 2019-06-17 15:39:33 · 1215 阅读 · 0 评论 -
MNIST手写数据集简单版本
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data # 载入数据集 mnist = input_data.read_data_sets("MNIST_data",one_hot=True) #图片的路径需要与运行文件的路径在同一级目录,或者也可以使用绝对路径 # 定义一个批次 ...原创 2019-06-17 17:26:39 · 817 阅读 · 0 评论 -
TensorFlow中卷积运算输出图片尺寸大小的计算,亲测有效,附例子
设输入图片尺寸为W,卷积核尺寸F,步距S,Padding为P。 一、当padding='SAME'时:卷积核尺寸不影响输出尺寸大小,输出尺寸为W/S,向上取整。(例如15.5=16) 例1:[W/S]=[32/2]=16 import tensorflow as tf input = tf.Variable(tf.random_normal([1, 32, 32, 3])) weight...原创 2019-08-28 13:22:26 · 1155 阅读 · 0 评论