チュートリアル翻訳: https://goo.gl/Vi9nox #!/usr/bin/env python import os import time import argparse import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data from tensorflow.python.tools.freeze_graph import freeze_graph def build_inference(x, keep_prob=None): def weight(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial, name='weight') def bias(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial, name='bias') def convolution(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME', name='convolutional') def pooling(x): return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME', name='pooling') x_image = tf.reshape(x, [-1,28,28,1]) with tf.name_scope('hidden_1'): W1 = weight([5, 5, 1, 32]) b1 = bias([32]) C1 = tf.nn.relu(convolution(x_image, W1) + b1) h1 = pooling(C1) with tf.name_scope('hidden_2'): W2 = weight([5, 5, 32, 64]) b2 = bias([64]) C2 = tf.nn.relu(convolution(h1, W2) + b2) h2 = pooling(C2) with tf.name_scope('fully_connect'):