parameters: (self,
             graph_def=None,
             init_op=None,
             clear_devices=False,
             default_graph_signature=None,
             named_graph_signatures=None,
             assets_collection=None,
             assets_callback=gfile_copy_callback)
docstring: Initialization.
  
      Args:
        graph_def: A GraphDef message of the graph to be used in inference.
          GraphDef of default graph is used when None.
        init_op: Op to be used in initialization.
        clear_devices: If device info of the graph should be cleared upon export.
        default_graph_signature: Default signature of the graph.
        named_graph_signatures: Map of named input/output signatures of the graph.
        assets_collection: A collection of constant asset filepath tensors. If set
          the assets will be exported into the asset directory.
        assets_callback: callback with two argument called during export with the
          list of files to copy and the asset path.
      Raises:
        RuntimeError: if init is called more than once.
        TypeError: if init_op is not an Operation or None.
        ValueError: if asset file path tensors are not non-empty constant string
          scalar tensors.
docstring_summary: Initialization.
docstring_tokens: Initialization .
function: def init(self,
             graph_def=None,
             init_op=None,
             clear_devices=False,
             default_graph_signature=None,
             named_graph_signatures=None,
             assets_collection=None,
             assets_callback=gfile_copy_callback):
      """Initialization.
  
      Args:
        graph_def: A GraphDef message of the graph to be used in inference.
          GraphDef of default graph is used when None.
        init_op: Op to be used in initialization.
        clear_devices: If device info of the graph should be cleared upon export.
        default_graph_signature: Default signature of the graph.
        named_graph_signatures: Map of named input/output signatures of the graph.
        assets_collection: A collection of constant asset filepath tensors. If set
          the assets will be exported into the asset directory.
        assets_callback: callback with two argument called during export with the
          list of files to copy and the asset path.
      Raises:
        RuntimeError: if init is called more than once.
        TypeError: if init_op is not an Operation or None.
        ValueError: if asset file path tensors are not non-empty constant string
          scalar tensors.
      """
      # Avoid Dangerous default value []
      if named_graph_signatures is None:
        named_graph_signatures = {}
      assets = []
      if assets_collection:
        for asset_tensor in assets_collection:
          asset_filepath = self._file_path_value(asset_tensor)
          if not asset_filepath:
            raise ValueError("invalid asset filepath tensor %s" % asset_tensor)
          basename = os.path.basename(asset_filepath)
          assets.append((basename, asset_tensor))
          self._assets_to_copy[asset_filepath] = basename
  
      if self._has_init:
        raise RuntimeError("init should be called only once")
      self._has_init = True
  
      if graph_def or clear_devices:
        copy = graph_pb2.GraphDef()
        if graph_def:
          copy.CopyFrom(graph_def)
        else:
          copy.CopyFrom(ops.get_default_graph().as_graph_def())
        if clear_devices:
          for node in copy.node:
            node.device = ""
        graph_any_buf = Any()
        graph_any_buf.Pack(copy)
        ops.add_to_collection(constants.GRAPH_KEY, graph_any_buf)
  
      if init_op:
        if not isinstance(init_op, ops.Operation):
          raise TypeError("init_op needs to be an Operation: %s" % init_op)
        ops.add_to_collection(constants.INIT_OP_KEY, init_op)
  
      signatures_proto = manifest_pb2.Signatures()
      if default_graph_signature:
        signatures_proto.default_signature.CopyFrom(default_graph_signature)
      for signature_name, signature in six.iteritems(named_graph_signatures):
        signatures_proto.named_signatures[signature_name].CopyFrom(signature)
      signatures_any_buf = Any()
      signatures_any_buf.Pack(signatures_proto)
      ops.add_to_collection(constants.SIGNATURES_KEY, signatures_any_buf)
  
      for filename, tensor in assets:
        asset = manifest_pb2.AssetFile()
        asset.filename = filename
        asset.tensor_binding.tensor_name = tensor.name
        asset_any_buf = Any()
        asset_any_buf.Pack(asset)
        ops.add_to_collection(constants.ASSETS_KEY, asset_any_buf)
  
      self._assets_callback = assets_callback
function_tokens: def init ( self , graph_def = None , init_op = None , clear_devices = False , default_graph_signature = None , named_graph_signatures = None , assets_collection = None , assets_callback = gfile_copy_callback ) : # Avoid Dangerous default value [] if named_graph_signatures is None : named_graph_signatures = { } assets = [ ] if assets_collection : for asset_tensor in assets_collection : asset_filepath = self . _file_path_value ( asset_tensor ) if not asset_filepath : raise ValueError ( "invalid asset filepath tensor %s" % asset_tensor ) basename = os . path . basename ( asset_filepath ) assets . append ( ( basename , asset_tensor ) ) self . _assets_to_copy [ asset_filepath ] = basename if self . _has_init : raise RuntimeError ( "init should be called only once" ) self . _has_init = True if graph_def or clear_devices : copy = graph_pb2 . GraphDef ( ) if graph_def : copy . CopyFrom ( graph_def ) else : copy . CopyFrom ( ops . get_default_graph ( ) . as_graph_def ( ) ) if clear_devices : for node in copy . node : node . device = "" graph_any_buf = Any ( ) graph_any_buf . Pack ( copy ) ops . add_to_collection ( constants . GRAPH_KEY , graph_any_buf ) if init_op : if not isinstance ( init_op , ops . Operation ) : raise TypeError ( "init_op needs to be an Operation: %s" % init_op ) ops . add_to_collection ( constants . INIT_OP_KEY , init_op ) signatures_proto = manifest_pb2 . Signatures ( ) if default_graph_signature : signatures_proto . default_signature . CopyFrom ( default_graph_signature ) for signature_name , signature in six . iteritems ( named_graph_signatures ) : signatures_proto . named_signatures [ signature_name ] . CopyFrom ( signature ) signatures_any_buf = Any ( ) signatures_any_buf . Pack ( signatures_proto ) ops . add_to_collection ( constants . SIGNATURES_KEY , signatures_any_buf ) for filename , tensor in assets : asset = manifest_pb2 . AssetFile ( ) asset . filename = filename asset . tensor_binding . tensor_name = tensor . name asset_any_buf = Any ( ) asset_any_buf . Pack ( asset ) ops . add_to_collection ( constants . ASSETS_KEY , asset_any_buf ) self . _assets_callback = assets_callback