code: def test_examples_cpp_mnist_runtime(
      tmpdir, nnabla_examples_root, batch_size
  ):
      pytest.skip(
          "Temporarily skip due to mnist training data server trouble."
      )
      nn.clear_parameters()
  
      # A. Check this test can run
      if not nnabla_examples_root.available:
          pytest.skip("`nnabla-examples` can not be found.")
  
      if not command_exists("mnist_runtime"):
          pytest.skip("An executable `mnist_runtime` is not in path.")
  
      tmpdir.chdir()
  
      # B. Run mnist training.
      script = os.path.join(
          nnabla_examples_root.path,
          "image-classification/mnist-collection",
          "classification.py",
      )
      check_call(["python", script, "-i", "100"])
  
      # C. Get mnist_runtime results.
      nnp_file = tmpdir.join("tmp.monitor", "lenet_result.nnp").strpath
      assert os.path.isfile(nnp_file)
      pgm_file = os.path.join(
          os.path.dirname(__file__),
          "../../../examples/cpp/mnist_runtime/1.pgm",
      )
      assert os.path.isfile(pgm_file)
      output = check_output(
          ["mnist_runtime", nnp_file, pgm_file, "Runtime"]
      )
      output.decode("ascii").splitlines()[1].split(":")[1].strip()
      cpp_result = np.asarray(
          output.decode("ascii")
          .splitlines()[1]
          .split(":")[1]
          .strip()
          .split(" "),
          dtype=np.float32,
      )
  
      # D. Get nnp_graph results and compare.
      from nnabla.utils import nnp_graph
  
      nnp = nnp_graph.NnpLoader(nnp_file)
      graph = nnp.get_network("Validation", batch_size=batch_size)
      x = graph.inputs["x"]
      y = graph.outputs["y"]
      from nnabla.utils.image_utils import imread
  
      img = imread(pgm_file, grayscale=True)
      x.d = img
      y.forward()
      assert_allclose(y.d.flatten(), cpp_result)
  
file_path: nnabla/python/test/cpp/test_mnist_runtime.py
imports: import pytest
  import nnabla
  import nnabla.utils.save
  import nnabla.utils.load
  from nnabla.testing import assert_allclose
  import numpy
  import os
  from subprocess import check_call, call, check_output
  import platform
label_desc: Use image node_id 2 for calling a global function with example usage: test_examples_cpp_mnist_runtime(tmpdir, nnabla_examples_root, batch_size) without return types