code: def save_test_data(
      model,
      onnx_model,
      test_data_path,
      input_data,
      output_data,
      name,
      tmpdir,
  ):
      if not onnx_model:
          return
  
      # cntk input/output has uid, onnx input/output has onnxname.
      # the way to link them together is to use the uid to onnxname map stored in onnx_model.graph.doc_string.
      onnx_model_description = onnx_model.graph.doc_string
      # onnx model description (of cntk exported model) is in this format:
      # <<<Uid, ONNXNodeName>>> pair: <<<uid_0, name_0>>> <<<uid_1, name_1>>> ... <<<uid_n, name_n>>>
      uid_name_map = dict(
          tuple(x[3:-3].split(", "))
          for x in re.findall(r"<<<[^>]*>>>", onnx_model_description)[
              1:
          ]
      )
      # input names are mapped from uid to names (requested by skype team)
      input_names = [
          x.uid if not x.name else x.name for x in model.arguments
      ]
  
      # handle block outputs
      output_names = []
      block_uid_count = {}
  
      # when block are exported as a single onnx node, the onnx node output takes name from block node output.
      # when block are exported by exporting nodes within that block, the onnx node output takes name from inner node output.
      # the cntk node that provides the name will have its uid stored in the uid_name_map.
      # this function tries to find the deepest inner output node whose uid is in uid_name_map.
      def find_deepest_inner_block_output(output):
          # might be a placeholder
          if not output.is_output:
              return False, output
          if output.owner and output.owner.is_block:
              block_uid_count[output.owner.uid] = (
                  block_uid_count[output.owner.uid] + 1
                  if output.owner.uid in block_uid_count
                  else 0
              )
              found, inner_output = find_deepest_inner_block_output(
                  output.owner.block_root.outputs[
                      block_uid_count[output.owner.uid]
                  ]
              )
              if found:
                  return True, inner_output
          return output.uid in uid_name_map, output
  
      for output in model.outputs:
          _, output = find_deepest_inner_block_output(output)
          output_names.append(uid_name_map[output.uid])
  
      if len(model.arguments) == 1:
          onnx_value_info_proto = (
              find_onnx_value_info_proto_with_matching_name(
                  onnx_model.graph.input,
                  input_names[0],
                  onnx_model.graph.input[0],
              )
          )
          save_cntk_data_as_onnx_tensor(
              os.path.join(
                  str(test_data_path), "input_{0}.pb".format(0)
              ),
              model.arguments[0],
              input_data,
              onnx_value_info_proto,
          )  # , data_type = np.int)
      else:
          for i in range(len(model.arguments)):
              onnx_value_info_proto = (
                  find_onnx_value_info_proto_with_matching_name(
                      onnx_model.graph.input,
                      input_names[i],
                      onnx_model.graph.input[i],
                  )
              )
              save_cntk_data_as_onnx_tensor(
                  os.path.join(
                      str(test_data_path), "input_{0}.pb".format(i)
                  ),
                  model.arguments[i],
                  input_data[i],
                  onnx_value_info_proto,
              )
  
      if len(model.outputs) == 1:
          onnx_value_info_proto = (
              find_onnx_value_info_proto_with_matching_name(
                  onnx_model.graph.output,
                  output_names[0],
                  onnx_model.graph.output[0],
              )
          )
          save_cntk_data_as_onnx_tensor(
              os.path.join(
                  str(test_data_path), "output_{0}.pb".format(0)
              ),
              model.outputs[0],
              output_data,
              onnx_value_info_proto,
          )
      else:
          for i in range(0, len(model.outputs)):
              output_data_i = None
              if type(output_data) == dict:
                  output_data_i = output_data[model.outputs[i]]
              else:
                  # models with such output exists
                  output_data_i = np.array(
                      output_data[None][0][model.outputs[i]]
                  )
              onnx_value_info_proto = (
                  find_onnx_value_info_proto_with_matching_name(
                      onnx_model.graph.output,
                      output_names[i],
                      onnx_model.graph.output[i],
                  )
              )
              save_cntk_data_as_onnx_tensor(
                  os.path.join(
                      str(test_data_path), "output_{0}.pb".format(i)
                  ),
                  model.outputs[i],
                  output_data_i,
                  onnx_value_info_proto,
              )
  
      # print out command line for onnx test runner
      print(get_onnx_test_runner_callscript(name, tmpdir))
  
      failed_cases_count = verify_results_with_onnxruntime(name, tmpdir)
      assert failed_cases_count == 0
  
imports: import os
  import re
  import shutil
  import numpy
  import scipy
  import cntk
  import pytest
  from .onnx_verify_helper import verify_results_with_onnxruntime, get_onnx_test_runner_callscript
label_desc: Use image node_id 11 for calling a global function with example usage: save_test_data(model, onnx_model, test_data_path, input_data, output_data, name, tmpdir) and returns: unknown,  output, False,  output, True,  inner_output