code: def gen_init_net_from_blobs(
      blobs, blobs_to_use=None, excluded_blobs=None
  ):
      """Generate an initialization net based on a blob dict"""
      ret = caffe2_pb2.NetDef()
      if blobs_to_use is None:
          blobs_to_use = {x for x in blobs}
      else:
          blobs_to_use = copy.deepcopy(blobs_to_use)
      if excluded_blobs is not None:
          blobs_to_use = [
              x for x in blobs_to_use if x not in excluded_blobs
          ]
      for name in blobs_to_use:
          blob = blobs[name]
          if isinstance(blob, str):
              print(
                  "Blob {} with type {} is not supported in generating init net,"
                  " skipped.".format(name, type(blob))
              )
              continue
          add_tensor(ret, name, blob)
  
      return ret
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  from functools import wraps
  import copy
  import numpy
  from caffe2.python import core, workspace
  from caffe2.proto import caffe2_pb2
label_desc: Use image node_id 16 for calling a global function with example usage: gen_init_net_from_blobs(blobs, blobs_to_use, excluded_blobs) and returns: ret