def bias_variable(shape):
  initial = tf.constant(0.1, shape=shape)
  return tf.Variable(initial)


def conv2d(x, W):
    return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')


def max_pool_2x2(x):
  return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],
                        strides=[1, 2, 2, 1], padding='SAME')

# Load the Digit DataSet
load_data = LoadData()
train_set_x, train_set_y = load_data.load_train_data("/home/darshan/Documents/DigitRecognizer/MNIST_data/",
                                                    "train.csv")

#mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)

x = tf.placeholder(tf.float32, [None, 784])
x_image = tf.reshape(x, [-1, 28, 28, 1])
y_ = tf.placeholder(tf.float32, [None, 10])

# First Layer of Convnet
W_conv1 = weight_variable([5, 5, 1, 32])
b_conv1 = bias_variable([32])

# 28 x 28 -> 24 x 24
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
# 24 x 24 -> 12 x 12
h_pool1 = max_pool_2x2(h_conv1)