Here is the source code for the example explained previously:
import matplotlib.pyplot as plt import numpy as np import math import tensorflow as tf import tensorflow.examples.tutorials.mnist.input_data as input_data #LOAD PACKAGES mnist = input_data.read_data_sets("data/", one_hot=True) trainimgs = mnist.train.images trainlabels = mnist.train.labels testimgs = mnist.test.images testlabels = mnist.test.labels ntrain = trainimgs.shape[0] ntest = testimgs.shape[0] dim = trainimgs.shape[1] nout = trainlabels.shape[1] print ("Packages loaded") #WEIGHT AND BIASES n1 = 16 n2 = 32 n3 = 64 ksize = 5 weights = { 'ce1': tf.Variable(tf.random_normal\ ([ksize, ksize, 1, n1],stddev=0.1)), 'ce2': tf.Variable(tf.random_normal\ ...