您好,欢迎来到99网。
搜索
您的当前位置:首页TensorFlow实现基础CNN,两层卷积+2层全连接网络demo

TensorFlow实现基础CNN,两层卷积+2层全连接网络demo

来源:99网

TensorFlow实现基础CNN,两层卷积+2层全连接网络demo,代码如下,注释都有

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

#加载数据集
mnist =input_data.read_data_sets( 'MNIST_data', one_hot = True)

#每个批次的大小
batch_size = 50

#共有xx个批次
n_batch =mnist.train.num_examples //batch_size

#初始化权重
def weight_variable( shape):
#生成shape结构的变量,方差=0.1
initial =tf.truncated_normal(shape, stddev = 0.1)
return tf.Variable(initial)

#初始化偏置
def bias_variable( shape):
initial =tf.constant( 0.1, shape =shape)
return

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 99spj.com 版权所有 湘ICP备2022005869号-5

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务