code: def vgg16(
      pretrained=False, end_with="outputs", mode="dynamic", name=None
  ):
      """Pre-trained VGG16 model.
  
      Parameters
      ------------
      pretrained : boolean
          Whether to load pretrained weights. Default False.
      end_with : str
          The end point of the model. Default ``fc3_relu`` i.e. the whole model.
      mode : str.
          Model building mode, 'dynamic' or 'static'. Default 'dynamic'.
      name : None or str
          A unique layer name.
  
      Examples
      ---------
      Classify ImageNet classes with VGG16, see `tutorial_models_vgg.py <https://github.com/tensorlayer/tensorlayer/blob/master/example/tutorial_models_vgg.py>`__
      With TensorLayer
  
      >>> # get the whole model, without pre-trained VGG parameters
      >>> vgg = tl.models.vgg16()
      >>> # get the whole model, restore pre-trained VGG parameters
      >>> vgg = tl.models.vgg16(pretrained=True)
      >>> # use for inferencing
      >>> output = vgg(img, is_train=False)
      >>> probs = tf.nn.softmax(output)[0].numpy()
  
      Extract features with VGG16 and Train a classifier with 100 classes
  
      >>> # get VGG without the last layer
      >>> cnn = tl.models.vgg16(end_with='fc2_relu', mode='static').as_layer()
      >>> # add one more layer and build a new model
      >>> ni = Input([None, 224, 224, 3], name="inputs")
      >>> nn = cnn(ni)
      >>> nn = tl.layers.Dense(n_units=100, name='out')(nn)
      >>> model = tl.models.Model(inputs=ni, outputs=nn)
      >>> # train your own classifier (only update the last layer)
      >>> train_params = model.get_layer('out').trainable_weights
  
      Reuse model
  
      >>> # in dynamic model, we can directly use the same model
      >>> # in static model
      >>> vgg_layer = tl.models.vgg16().as_layer()
      >>> ni_1 = tl.layers.Input([None, 224, 244, 3])
      >>> ni_2 = tl.layers.Input([None, 224, 244, 3])
      >>> a_1 = vgg_layer(ni_1)
      >>> a_2 = vgg_layer(ni_2)
      >>> M = Model(inputs=[ni_1, ni_2], outputs=[a_1, a_2])
  
      """
      if mode == "dynamic":
          model = VGG(
              layer_type="vgg16",
              batch_norm=False,
              end_with=end_with,
              name=name,
          )
      elif mode == "static":
          model = VGG_static(
              layer_type="vgg16",
              batch_norm=False,
              end_with=end_with,
              name=name,
          )
      else:
          raise Exception("No such mode %s" % mode)
      if pretrained:
          restore_model(model, layer_type="vgg16")
      return model
  
file_path: TensorLayer/tensorlayer/models/vgg.py
imports: import os
  import numpy
  import tensorflow
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.files import assign_weights, maybe_download_and_extract
  from tensorlayer.layers import BatchNorm, Conv2d, Dense, Flatten, Input, Lambda, LayerList, MaxPool2d
  from tensorlayer.models import Model
label_desc: Use image node_id 4 for calling a global function with example usage: vgg16(pretrained, end_with, mode, name) and returns: model