本帖最后由 Oner 于 2018-3-26 21:30 编辑
功能点
TensorFlow实现MLP(多层感知机)
运行环境
Python 2.7
Jupyter Notebook 4.3.0
代码预览
[mw_shl_code=python,true]import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
# one_hot=True 目的是将 label 进行 one-hot 编码
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
sess = tf.Session()
in_units = 784
h1_units = 300
W1 = tf.Variable(tf.truncated_normal([in_units, h1_units], stddev=0.1))
b1 = tf.Variable(tf.zeros([h1_units]))
W2 = tf.Variable(tf.zeros([h1_units, 10]))
b2 = tf.Variable(tf.zeros([10]))[/mw_shl_code]
代码下载
02. MLP(Multilayer Perceptron).zip
(2.76 KB, 下载次数: 3)
|
|