In [11]:
import tensorflow as tf
In [12]:
import numpy as np
from sklearn import metrics
In [13]:
layers = tf.contrib.layers
learn = tf.contrib.learn
In [14]:
def max_poll_2x2(tensor_in):
return tf.nn.max_pool(tensor_in, ksize=[1,2,2,1], strides=[1,2,2,1], padding='SAME')
In [15]:
def conv_model(feature, target, mode):
target = tf.one_hot(tf.cast(target, tf.int32),10, 1, 0)
feature = tf.reshape(feature, [-1, 28, 28, 1])
with tf.variable_scope('conv_layer1'):
h_conv1 = layers.convolution2d(feature, 32,
kernel_size=[5,5], activation_fn = tf.nn.relu)
h_pool1 = max_pool_2x2(h_conv1)