MNIST本地加载,简单神经网络,run练习

本文档介绍了如何在本地加载MNIST数据集,并实现一个简单的神经网络进行手写数字识别的训练和运行。通过这次练习,读者可以深入理解神经网络的基本原理和流程。
摘要由CSDN通过智能技术生成
import tensorflow as tf
import get_Dataset
import numpy as np

x_train, y_train, x_test, y_test = get_Dataset.get_Dataset('mnist')

batch_size = 100
x = tf.placeholder(tf.float32, shape=[None, 784])
y = tf.placeholder(tf.float32, shape=[None, 10])
y_ = tf.placeholder(tf.int64, shape=[1, None])

w_l1 = tf.Variable(tf.random_normal([784, 200], dtype=tf.float32))
biase_l1 = tf.Variable(tf.random_normal([200], dtype=tf.float32))
z_l1 = tf.matmul(x, w_l1) + biase_l1
a_l1 = tf.nn.tanh(z_l1)

w_l2 = tf.Variable(tf.random_normal([200, 10], dtype=tf.float32))
biase_l2 = tf.Variable(tf.random_normal([10], dtype=tf.float32))
z_l2 = tf.matmul(a_l1, w_l2) + bia
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值