学习进度笔记23

今天通过观看老师分享的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)
#print
trainimg = mnist.train.images
trainlabel = mnist.train.labels
testimg = mnist.test.images
testlabel = mnist.test.labels
print("MNIST READY")
n_input = 784
n_output = 10
weights = {
'wc1': tf.Variable(tf.random_normal([3,3,1,64],stddev=0.1))
'wc2': tf.Variable(tf.random_normal([3, 3, 64, 128], stddev=0.1))
'wd1': tf.Variable(tf.random_normal([7*7*128,1024], stddev=0.1))
'wd2': tf.Variable(tf.random_normal([1024,n_output], stddev=0.1))
}
biases = {
'wc1': tf.Variable(tf.random_normal([64], stddev=0.1))
'wc2': tf.Variable(tf.random_normal([128], stddev=0.1))
'wd1': tf.Variable(tf.random_normal([1024], stddev=0.1))
'wd2': tf.Variable(tf.random_normal([n_output], stddev=0.1))
}
上一篇:Python 3: UnboundLocalError: local variable referenced before assignment [duplicate]


下一篇:python 的“类”的应用