code: def _metadata():
      def parse_functions(function_info):
          functions = []
          for category_name, category in function_info.items():
              for function_name, function_value in category.items():
                  function = {
                      "name": function_name,
                      "description": function_value["doc"].strip(),
                  }
                  for input_name, input_value in function_value.get(
                      "inputs", {}
                  ).items():
                      function.setdefault("inputs", []).append(
                          {
                              "name": input_name,
                              "type": "nnabla.Variable",
                              "option": "optional"
                              if input_value.get("optional", False)
                              else None,
                              "list": input_value.get(
                                  "variadic", False
                              ),
                              "description": input_value["doc"].strip(),
                          }
                      )
                  for arg_name, arg_value in function_value.get(
                      "arguments", {}
                  ).items():
                      attribute = _attribute(arg_name, arg_value)
                      function.setdefault("attributes", []).append(
                          attribute
                      )
                  for output_name, output_value in function_value.get(
                      "outputs", {}
                  ).items():
                      function.setdefault("outputs", []).append(
                          {
                              "name": output_name,
                              "type": "nnabla.Variable",
                              "list": output_value.get(
                                  "variadic", False
                              ),
                              "description": output_value[
                                  "doc"
                              ].strip(),
                          }
                      )
                  if "Pooling" in function_name:
                      function["category"] = "Pool"
                  elif category_name == "Neural Network Layer":
                      function["category"] = "Layer"
                  elif (
                      category_name
                      == "Neural Network Activation Functions"
                  ):
                      function["category"] = "Activation"
                  elif category_name == "Normalization":
                      function["category"] = "Normalization"
                  elif category_name == "Logical":
                      function["category"] = "Logic"
                  elif category_name == "Array Manipulation":
                      function["category"] = "Shape"
                  functions.append(function)
          return functions
  
      def cleanup_functions(functions):
          for function in functions:
              for inp in function.get("inputs", []):
                  if inp["option"] is None:
                      inp.pop("option", None)
                  if not inp["list"]:
                      inp.pop("list", None)
              for output in function.get("outputs", []):
                  if not output["list"]:
                      output.pop("list", None)
  
      root = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
      functions_yaml_path = os.path.join(
          root,
          "third_party",
          "source",
          "nnabla",
          "build-tools",
          "code_generator",
          "functions.yaml",
      )
      function_info = _read_yaml(functions_yaml_path)
      functions = parse_functions(function_info)
      cleanup_functions(functions)
      _write(
          os.path.join(root, "source", "nnabla-metadata.json"),
          json.dumps(functions, indent=2),
      )
  
file_path: netron/tools/nnabla_script.py
imports: import json
  import sys
  import os
  import yaml
  import mako.template
label_desc: Use image node_id 3 for calling a global function with example usage: _metadata() and returns: functions