code: def main():
      # Read envvar `NNABLA_EXAMPLES_ROOT` to identify the path to your local
      # nnabla-examples directory.
      HERE = os.path.dirname(__file__)
      nnabla_examples_root = os.environ.get(
          "NNABLA_EXAMPLES_ROOT",
          os.path.join(HERE, "../../../../nnabla-examples"),
      )
      mnist_examples_root = os.path.realpath(
          os.path.join(
              nnabla_examples_root,
              "image-classification/mnist-collection",
          )
      )
      sys.path.append(mnist_examples_root)
      nnabla_examples_git_url = (
          "https://github.com/sony/nnabla-examples"
      )
  
      # Check if nnabla-examples found.
      try:
          from args import get_args
      except ImportError:
          print(
              "An envvar `NNABLA_EXAMPLES_ROOT`"
              " which locates the local path to "
              "[nnabla-examples]({})"
              " repository must be set correctly.".format(
                  nnabla_examples_git_url
              ),
              file=sys.stderr,
          )
          raise
  
      # Import MNIST data
      from mnist_data import data_iterator_mnist
      from classification import (
          mnist_lenet_prediction,
          mnist_resnet_prediction,
      )
  
      args = get_args(description=__doc__)
  
      mnist_cnn_prediction = mnist_lenet_prediction
      if args.net == "resnet":
          mnist_cnn_prediction = mnist_resnet_prediction
  
      # Infer parameter file name and read it.
      model_save_path = os.path.join(
          mnist_examples_root, args.model_save_path
      )
      parameter_file = os.path.join(
          model_save_path,
          "{}_params_{:06}.h5".format(args.net, args.max_iter),
      )
      try:
          nn.load_parameters(parameter_file)
      except IOError:
          logger.error(
              "Run classification.py before running this script."
          )
          exit(1)
  
      # Create a computation graph to be saved.
      image = nn.Variable([args.batch_size, 1, 28, 28])
      pred = mnist_cnn_prediction(image, test=True)
  
      # Save NNP file (used in C++ inference later.).
      nnp_file = "{}_{:06}.nnp".format(args.net, args.max_iter)
      runtime_contents = {
          "networks": [
              {
                  "name": "runtime",
                  "batch_size": args.batch_size,
                  "outputs": {"y": pred},
                  "names": {"x": image},
              }
          ],
          "executors": [
              {
                  "name": "runtime",
                  "network": "runtime",
                  "data": ["x"],
                  "output": ["y"],
              }
          ],
      }
      nn.utils.save.save(nnp_file, runtime_contents)
  
imports: from __future__ import absolute_import, print_function
  import nnabla
  import nnabla.logger
  import os
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: main() without return types