code: def _dump_protobuf(args, proto, prefix, depth):
      if args.dump_verbose:
          if 0 <= depth <= len(prefix):
              print("{} ...".format(":".join(prefix)))
              return
          for desc, field in proto.ListFields():
              if isinstance(field, (int, float, complex, str)):
                  print(
                      "{}:{}: {}".format(
                          ":".join(prefix), desc.name, field
                      )
                  )
              elif isinstance(field, collections.Iterable):
                  print(
                      "{} has {} {}(s).".format(
                          ":".join(prefix), len(field), desc.name
                      )
                  )
                  for n, f in enumerate(field[: args.dump_limit]):
                      if isinstance(f, (int, float, complex, str)):
                          print(
                              "{}:{}[{}]: {}".format(
                                  ":".join(prefix), desc.name, n, f
                              )
                          )
                      else:
                          if depth < 0 or depth > len(prefix) + 1:
                              _dump_protobuf(
                                  args,
                                  f,
                                  prefix
                                  + ["{}[{}]".format(desc.name, n)],
                                  depth,
                              )
              else:
                  _dump_protobuf(
                      args, field, prefix + [desc.name], depth
                  )
      else:
          params = {}
          for par in proto.parameter:
              params[par.variable_name] = [x for x in par.shape.dim]
  
          nets = {}
          for net in proto.network:
              ninfo = {"variables": {}, "functions": []}
              for var in net.variable:
                  if var.type == "Parameter":
                      if var.name not in params:
                          print(
                              "[ERROR] Parameter [{}] in network[{}] not found.".format(
                                  var.name, net.name
                              )
                          )
                          print(
                              "        "
                              + "Make sure that you do not forget to read parameter file."
                          )
                          print(
                              "        "
                              + "Otherwise it should be expander problem. Please report us."
                          )
                          sys.exit(-1)
  
                  ninfo["variables"][var.name] = {
                      "type": var.type,
                      "shape": [x for x in var.shape.dim],
                  }
  
              for func in net.function:
                  ninfo["functions"].append(func)
  
              nets[net.name] = ninfo
  
          def _dump_network_arg(prefix, name, var):
              for i, v in enumerate(var):
                  shape = " - "
                  if v.variable_name in net["variables"]:
                      shape = net["variables"][v.variable_name]["shape"]
                  print(
                      "{}{} variable[{}]:".format(prefix, name, i)
                      + " Name:{:30}".format(v.variable_name)
                      + " Shape:{}".format(shape)
                  )
  
          def _dump_network(prefix, net):
              if args.dump_variable_name:
                  if args.dump_variable_name in net["variables"]:
                      v = args.dump_variable_name
                      print(
                          "Variable Name: {:20} Shape: {}".format(
                              v, net["variables"][v]["shape"]
                          )
                      )
                  else:
                      print(
                          "DUMP ERROR: variable {} not found.".format(
                              args.dump_variable_name
                          )
                      )
                  return
              if args.dump_functions:
                  for i, f in enumerate(net["functions"]):
                      func_prefix = "{}  Function[{:^5}]: ".format(
                          prefix, i
                      )
                      print(
                          "{}Type: {:20} Name: {}".format(
                              func_prefix, f.type, f.name
                          )
                      )
                      if args.dump_variables:
                          for j, v in enumerate(f.input):
                              print(
                                  "{}  Input{}: Name: {:20} Shape: {}".format(
                                      func_prefix,
                                      j,
                                      v,
                                      net["variables"][v]["shape"],
                                  )
                              )
                          for j, v in enumerate(f.output):
                              print(
                                  "{} Output{}: Name: {:20} Shape: {}".format(
                                      func_prefix,
                                      j,
                                      v,
                                      net["variables"][v]["shape"],
                                  )
                              )
  
          for i, opt in enumerate(proto.optimizer):
              net = nets[opt.network_name]
              prefix = "  Optimizer[{}]: ".format(i)
              print("{}{}".format(prefix, opt.name))
  
              _dump_network_arg(
                  prefix, " (In) Data     ", opt.data_variable
              )
              _dump_network_arg(
                  prefix, " (In) Generator", opt.generator_variable
              )
              _dump_network_arg(
                  prefix, " (Out)Loss     ", opt.loss_variable
              )
              _dump_network(prefix, net)
  
          for i, mon in enumerate(proto.monitor):
              net = nets[mon.network_name]
              prefix = "  Monitor  [{}]: ".format(i)
              print("{}{}".format(prefix, mon.name))
              _dump_network_arg(
                  prefix, " (In) Data     ", mon.data_variable
              )
              _dump_network_arg(
                  prefix, " (In) Generator", mon.generator_variable
              )
              _dump_network_arg(
                  prefix, " (Out)Monitor  ", mon.monitor_variable
              )
              _dump_network(prefix, net)
  
          for i, exe in enumerate(proto.executor):
              net = nets[exe.network_name]
              prefix = "  Executor [{}]: ".format(i)
              print("{}{}".format(prefix, exe.name))
              _dump_network_arg(
                  prefix, " (In) Data     ", exe.data_variable
              )
              _dump_network_arg(
                  prefix, " (In) Generator", exe.generator_variable
              )
              _dump_network_arg(
                  prefix, " (Out)Loss     ", exe.loss_variable
              )
              _dump_network_arg(
                  prefix, " (Out)Output   ", exe.output_variable
              )
              _dump_network(prefix, net)
  
file_path: nnabla/python/src/nnabla/utils/converter/commands.py
imports: import collections
  import os
  import sys
  from .nnabla import NnpImporter, NnpExporter
  from .nnablart import NnbExporter, CsrcExporter
  from .utils import func_set_import_nnp, func_set_import_onnx_config, func_set_import_config, func_set_nnabla_support, func_set_onnx_support, func_set_nnabla_version_decorate
  from nnabla.logger import logger
label_desc: Use image node_id 9 for calling a global function with example usage: _dump_protobuf(args, proto, prefix, depth) without return types