学习进度笔记21

今天通过观看老师分享的TensorFlow教学视频,学习了如何构建神经网络模型的架构,具体的各项参数的赋值情况如下:

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data

mnist = input_data.read_data_sets('data/',one_hot=True)

h1 = 256
h2 = 128
input = 784
n_class = 10

x = tf.placeholder("float",[None,input])
y = tf.placeholder("float",[None],n_class)

stddev = 0.1
weights = {
'w1':tf.Variable(tf.random_normal([input,h1],stddev=stddev)),
'w2':tf.Variable(tf.random_normal([h1,h2],stddev=stddev)),
'out':tf.Variable(tf.random_normal([h2,n_class],stddev=stddev))
}
biases = {
'b1':tf.Variable(tf.random_normal([h1])),
'b2':tf.Variable(tf.random_normal([h2])),
'out':tf.Variable(tf.random_normal([n_class]))
}
print("NETWORK READY")
posted @ 2021-02-01 12:33  20183602  阅读(51)  评论(0编辑  收藏  举报