code: def model(inputs_shape, n_class=10):
      in_net = Input(inputs_shape, name="input")
      net = TernaryConv2d(
          32, (5, 5), (1, 1), padding="SAME", b_init=None, name="bcnn1"
      )(in_net)
      net = MaxPool2d((2, 2), (2, 2), padding="SAME", name="pool1")(net)
      net = BatchNorm(act=tl.act.htanh, name="bn1")(net)
  
      net = TernaryConv2d(
          64, (5, 5), (1, 1), padding="SAME", b_init=None, name="bcnn2"
      )(net)
      net = MaxPool2d((2, 2), (2, 2), padding="SAME", name="pool2")(net)
      net = BatchNorm(act=tl.act.htanh, name="bn2")(net)
  
      net = Flatten("flatten")(net)
      net = Dense(256, b_init=None, name="dense")(net)
      net = BatchNorm(act=tl.act.htanh, name="bn3")(net)
  
      net = TernaryDense(n_class, b_init=None, name="bout")(net)
      net = BatchNorm(name="bno")(net)
  
      net = Model(inputs=in_net, outputs=net, name="dorefanet")
      return net
  
file_path: TensorLayer/examples/quantized_net/tutorial_ternaryweight_mnist_cnn.py
imports: import time
  import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer.layers import BatchNorm, Dense, Flatten, Input, MaxPool2d, TernaryConv2d, TernaryDense
  from tensorlayer.models import Model
label_desc: Use image node_id 1 for calling a global function with example usage: model(inputs_shape, n_class) and returns: net