code: def _net2pb(net):
      if isinstance(net, HybridBlock):
          # TODO(junwu): may need a more approprite way to get symbol from a HybridBlock
          if not net._cached_graph:
              raise RuntimeError(
                  "Please first call net.hybridize() and then run forward with "
                  "this net at least once before calling add_graph()."
              )
          net = net._cached_graph[1]
      elif not isinstance(net, Symbol):
          raise TypeError(
              "only accepts mxnet.gluon.HybridBlock and mxnet.symbol.Symbol "
              "as input network, received type {}".format(
                  str(type(net))
              )
          )
      return _sym2pb(net)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import logging
  import io
  import wave
  import struct
  import json
  import re
  import numpy
  from mxnet.ndarray import NDArray
  from mxnet.symbol import Symbol
  from mxnet.gluon import HybridBlock
  from .proto.summary_pb2 import Summary
  from .proto.summary_pb2 import HistogramProto
  from .proto.summary_pb2 import SummaryMetadata
  from .proto.tensor_pb2 import TensorProto
  from .proto.tensor_shape_pb2 import TensorShapeProto
  from .proto.plugin_pr_curve_pb2 import PrCurvePluginData
  from .proto.node_def_pb2 import NodeDef
  from .proto.graph_pb2 import GraphDef
  from .proto.attr_value_pb2 import AttrValue
  from .proto.versions_pb2 import VersionDef
  from .utils import _make_numpy_array, _prepare_image
label_desc: Use image node_id 14 for calling a global function with example usage: _net2pb(net) and returns: _sym2pb