text: import tensorflow as tf
  from tensorflow.contrib.layers import flatten
  
  def LeNet6(x):    
      # Arguments used for tf.truncated_normal, randomly defines variables for the weights and biases for each layer
      mu = 0
      sigma = 0.1
      
      # Layer 1: Convolutional. Input = 32x32x1. Output = 28x28x6.
      conv1_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 1, 6), mean = mu, stddev = sigma))
      conv1_b = tf.Variable(tf.zeros(6))
      conv1   = tf.nn.conv2d(x, conv1_W, strides=[1, 1, 1, 1], padding='VALID') + conv1_b
  
      # Activation.
      conv1 = tf.nn.relu(conv1)
  
      # Pooling. Input = 28x28x6. Output = 14x14x6.
      conv1 = tf.nn.max_pool(conv1, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
  
      # Layer 2: Convolutional. Output = 10x10x16.
      conv2_W = tf.Variable(tf.truncated_normal(shape=(5, 5, 6, 16), mean = mu, stddev = sigma))
      conv2_b = tf.Variable(tf.zeros(16))
      conv2   = tf.nn.conv2d(conv1, conv2_W, strides=[1, 1, 1, 1], padding='VALID') + conv2_b
      
      # Activation.
      conv2 = tf.nn.relu(conv2)
  
      # Pooling. Input = 10x10x16. Output = 5x5x16.
      conv2 = tf.nn.max_pool(conv2, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='VALID')
  
      # Flatten. Input = 5x5x16. Output = 400.
      fc0   = flatten(conv2)
      
      # Layer 3: Fully Connected. Input = 400. Output = 120.
      fc1_W = tf.Variable(tf.truncated_normal(shape=(400, 120), mean = mu, stddev = sigma))
      fc1_b = tf.Variable(tf.zeros(120))
      fc1   = tf.matmul(fc0, fc1_W) + fc1_b
      
      # Activation.
      fc1    = tf.nn.relu(fc1)
  
      # Layer 4: Fully Connected. Input = 120. Output = 84.
      fc2_W  = tf.Variable(tf.truncated_normal(shape=(120, 84), mean = mu, stddev = sigma))
      fc2_b  = tf.Variable(tf.zeros(84))
      fc2    = tf.matmul(fc1, fc2_W) + fc2_b
      
      # Activation.
      fc2    = tf.nn.relu(fc2)
  
      # Layer 5: Fully Connected. Input = 84. Output = 84.
      fc3_W  = tf.Variable(tf.truncated_normal(shape=(84, 84), mean = mu, stddev = sigma))
      fc3_b  = tf.Variable(tf.zeros(84))
      fc3    = tf.matmul(fc2, fc3_W) + fc3_b
      
      # Activation.
      fc3    = tf.nn.relu(fc3)
      
      # Layer 6: Fully Connected. Input = 84. Output = 43.    
      fc4_W  = tf.Variable(tf.truncated_normal(shape=(84, n_classes), mean = mu, stddev = sigma))
      fc4_b  = tf.Variable(tf.zeros(n_classes))
      logits = tf.matmul(fc3, fc4_W) + fc4_b
      
      return logits
  