code: 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=100, 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
      fc3 = brew.fc(
          model, pool2, "fc3", dim_in=100 * 4 * 4, dim_out=500
      )
      relu = brew.relu(model, fc3, fc3)
      pred = brew.fc(model, relu, "pred", 500, 10)
      softmax = brew.softmax(model, pred, "softmax")
      return softmax
  
file_path: pytorch-tensorboardx/examples/demo_caffe2.py
imports: import numpy
  import os
  import shutil
  from caffe2.python import core, model_helper, workspace, brew
  from tensorboardX import TorchVis
label_desc: Use image node_id 3 for calling a global function with example usage: AddLeNetModel(model, data) and returns: softmax