(model, data)
return softmax
This part is the standard LeNet model: from data to the softmax prediction.
    
    For each convolutional layer we specify dim_in - number of input channels
    and dim_out - number or output channels. Also each Conv and MaxPool layer changes the
    image size. For example, kernel of size 5 reduces each side of an image by 4.

    While when we have kernel and stride sizes equal 2 in a MaxPool layer, it divides
    each side in half.
This part is the standard LeNet model: from data to the softmax prediction.
    
    For each convolutional layer we specify dim_in - number of input channels
    and dim_out - number or output channels. Also each Conv and MaxPool layer changes the
    image size. For example, kernel of size 5 reduces each side of an image by 4.
This part is the standard LeNet model : from data to the softmax prediction . For each convolutional layer we specify dim_in - number of input channels and dim_out - number or output channels . Also each Conv and MaxPool layer changes the image size . For example kernel of size 5 reduces each side of an image by 4 .
def AddLeNetModel(model, data):
    '''
    This part is the standard LeNet model: from data to the softmax prediction.
    
    For each convolutional layer we specify dim_in - number of input channels
    and dim_out - number or output channels. Also each Conv and MaxPool layer changes the
    image size. For example, kernel of size 5 reduces each side of an image by 4.

    While when we have kernel and stride sizes equal 2 in a MaxPool layer, it divides
    each side in half.
    '''
    # Image size: 28 x 28 -> 24 x 24
    conv1 = brew.conv(model, data, 'conv1', dim_in=1, dim_out=20, kernel=5)
    # Image size: 24 x 24 -> 12 x 12
    pool1 = brew.max_pool(model, conv1, 'pool1', kernel=2, stride=2)
    # Image size: 12 x 12 -> 8 x 8
    conv2 = brew.conv(model, pool1, 'conv2', dim_in=20, dim_out=50, kernel=5)
    # Image size: 8 x 8 -> 4 x 4
    pool2 = brew.max_pool(model, conv2, 'pool2', kernel=2, stride=2)
    # 50 * 4 * 4 stands for dim_out from previous layer multiplied by the image size
    # Here, the data is flattened from a tensor of dimension 50x4x4 to a vector of length 50*4*4
    fc3 = brew.fc(model, pool2, 'fc3', dim_in=50 * 4 * 4, dim_out=500)
    relu3 = brew.relu(model, fc3, 'relu3')
    # Last FC Layer
    pred = brew.fc(model, relu3, 'pred', dim_in=500, dim_out=10)
    # Softmax Layer
    softmax = brew.softmax(model, pred, 'softmax')
    
    return softmax
def AddLeNetModel ( model , data ) : # Image size: 28 x 28 -> 24 x 24 conv1 = brew . conv ( model , data , 'conv1' , dim_in = 1 , dim_out = 20 , kernel = 5 ) # Image size: 24 x 24 -> 12 x 12 pool1 = brew . max_pool ( model , conv1 , 'pool1' , kernel = 2 , stride = 2 ) # Image size: 12 x 12 -> 8 x 8 conv2 = brew . conv ( model , pool1 , 'conv2' , dim_in = 20 , dim_out = 50 , kernel = 5 ) # Image size: 8 x 8 -> 4 x 4 pool2 = brew . max_pool ( model , conv2 , 'pool2' , kernel = 2 , stride = 2 ) # 50 * 4 * 4 stands for dim_out from previous layer multiplied by the image size # Here, the data is flattened from a tensor of dimension 50x4x4 to a vector of length 50*4*4 fc3 = brew . fc ( model , pool2 , 'fc3' , dim_in = 50 * 4 * 4 , dim_out = 500 ) relu3 = brew . relu ( model , fc3 , 'relu3' ) # Last FC Layer pred = brew . fc ( model , relu3 , 'pred' , dim_in = 500 , dim_out = 10 ) # Softmax Layer softmax = brew . softmax ( model , pred , 'softmax' ) return softmax