code: def transfer(model, param, net):
      name_config = dict([(l.name, l) for l in net.layer])
      for layer in param.layer:
          if layer.name not in name_config:
              continue
          config = name_config[layer.name]
          if layer.name.startswith("conv1"):
              model.extractor = copy_res1(
                  layer, config, model.extractor
              )
          elif layer.name.startswith("conv2"):
              model.extractor.res2 = copy_resblock(
                  layer, config, model.extractor.res2
              )
          elif layer.name.startswith("conv3"):
              model.extractor.res3 = copy_resblock(
                  layer, config, model.extractor.res3
              )
          elif layer.name.startswith("conv4"):
              model.extractor.res4 = copy_resblock(
                  layer, config, model.extractor.res4
              )
          elif (
              layer.name.startswith("conv5")
              and "pool" not in layer.name
              and "conv5_4" not in layer.name
          ):
              model.extractor.res5 = copy_resblock(
                  layer, config, model.extractor.res5
              )
          elif (
              layer.name.startswith("conv5_3") and "pool" in layer.name
          ):
              model.ppm = copy_ppm_module(layer, config, model.ppm)
          elif layer.name.startswith("conv5_4"):
              model.head_conv1 = copy_conv2d_bn_activ(
                  layer, config, model.head_conv1
              )
          elif layer.name.startswith("conv6"):
              model.head_conv2 = copy_conv(
                  layer, config, model.head_conv2, has_bias=True
              )
          # NOTE: Auxirillary is not copied
          else:
              print("Ignored: {} ({})".format(layer.name, layer.type))
      return model
  
file_path: chainercv/examples/pspnet/caffe2npz.py
imports: import argparse
  from google.protobuf import text_format
  import numpy
  import re
  from chainer import serializers
  from chainercv.experimental.links import PSPNetResNet101
  import caffe_pb2
label_desc: Use image node_id 7 for calling a global function with example usage: transfer(model, param, net) and returns: model