code: def restore_model(model, layer_type):
      logging.info("Restore pre-trained weights")
      # download weights
      maybe_download_and_extract(
          model_saved_name[layer_type], "models", model_urls[layer_type]
      )
      weights = []
      if layer_type == "vgg16":
          npz = np.load(
              os.path.join("models", model_saved_name[layer_type]),
              allow_pickle=True,
          )
          # get weight list
          for val in sorted(npz.items()):
              logging.info(
                  "  Loading weights %s in %s"
                  % (str(val[1].shape), val[0])
              )
              weights.append(val[1])
              if len(model.all_weights) == len(weights):
                  break
      elif layer_type == "vgg19":
          npz = np.load(
              os.path.join("models", model_saved_name[layer_type]),
              allow_pickle=True,
              encoding="latin1",
          ).item()
          # get weight list
          for val in sorted(npz.items()):
              logging.info(
                  "  Loading %s in %s" % (str(val[1][0].shape), val[0])
              )
              logging.info(
                  "  Loading %s in %s" % (str(val[1][1].shape), val[0])
              )
              weights.extend(val[1])
              if len(model.all_weights) == len(weights):
                  break
      # assign weight values
      assign_weights(weights, model)
      del weights
  
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 2 for calling a global function with example usage: restore_model(model, layer_type) without return types