code: def test_cntk_rnn_models(
      model_name, use_external_files_to_store_parameters
  ):
      if model_name in skip_rnn_model_names:
          pytest.skip("Skip cntk rnn model test. ")
  
      rnn_base_dir = get_base_dir("rnn_models")
      model_dir = os.path.join(rnn_base_dir, model_name)
      model = C.Function.load(model_dir, format=C.ModelFormat.CNTKv2)
  
      # Generate model-specific data
      data = []
      np.random.seed(0)
      sequence_length = 10
  
      if (
          model_name
          == "SmartReply.Base_BiLSTM_gather_indice_input.model"
      ):
          feature_size = 99466
          data.append(
              generate_sequence_data(
                  1, sequence_length, feature_size, input_as_index=True
              )
          )
      elif model_name == "SmartReply.SelfAtt.infer_model.cnt.model":
          data = []
          batch_size, seq_len = 1, 17
          for arg in model.arguments[:-1]:
              # data = [*data, generate_sparse_data_no_batch(seq_len, arg.shape[0])]
              data.append(
                  generate_sparse_data(
                      batch_size, seq_len, arg.shape[0]
                  )
              )
          # the last argument is a sequence of booleans of length 8
          data.append(
              np.array(
                  [[[1], [0], [1], [0], [1], [1], [0], [1]]]
              ).astype(np.float32)
          )
      elif (
          model_name == "Speech.lstm_pit.cntk48.ElementTimes3117.model"
      ):
          (
              batch_size,
              seq_len,
              feature_size,
              feature_size2,
              feature_size3,
          ) = (1, 17, 257, 1542, 257)
          data1 = np.random.rand(
              batch_size, seq_len, feature_size
          ).astype(np.float32)
          data2 = np.random.rand(
              batch_size, seq_len, feature_size2
          ).astype(np.float32)
          data3 = np.random.rand(
              batch_size, seq_len, feature_size3
          ).astype(np.float32)
          data = [data1, data2, data3]
      elif model_name == "LocalIntent.reduced.model":
          batch_size, seq_len = 1, 3
          f1, f2, f3, f4, f5 = 300, 1119, 9, 10, 12
          data1 = np.random.rand(batch_size, seq_len, f1).astype(
              np.float32
          )
          data2 = generate_sparse_data(batch_size, seq_len, f2)
          data3 = np.random.rand(batch_size, seq_len, f3).astype(
              np.float32
          )
          data4 = np.random.rand(batch_size, seq_len, f4).astype(
              np.float32
          )
          data5 = np.random.rand(batch_size, seq_len, f5).astype(
              np.float32
          )
          data = [data1, data2, data3, data4, data5]
      else:
          for arg in model.arguments:
              if model_name in models_with_sequential_data:
                  data.append(
                      generate_sequential_data(
                          (1, sequence_length) + arg.shape
                      )
                  )
              elif model_name in seq_models_with_sparse_data:
                  data.append(
                      generate_sparse_data(
                          1, sequence_length, arg.shape[0]
                      )
                  )
              elif model_name in non_seq_models_with_sparse_data:
                  data.append(
                      generate_sparse_data_non_seq(1, arg.shape[0])
                  )
              else:
                  data.append(
                      generate_sequence_data(
                          1, sequence_length, arg.shape[0]
                      )
                  )
  
      # Validate model results
      test_name = (
          model_name + "_ext_"
          if use_external_files_to_store_parameters
          else model_name
      )
      if model_name in verify_with_resave:
          verify_model(
              model,
              None,
              tmpdir,
              test_name,
              data[0] if len(data) == 1 else data,
              True,
              use_external_files_to_store_parameters=use_external_files_to_store_parameters,
          )
      else:
          save_onnx_model_with_validation_data(
              tmpdir,
              model,
              data[0] if len(data) == 1 else data,
              test_name,
              device=None,
              use_external_files_to_store_parameters=use_external_files_to_store_parameters,
          )
          verify_results_with_onnxruntime(
              test_name, str(os.path.abspath(tmpdir))
          )
  
file_path: CNTK/bindings/python/cntk/tests/onnx_model_test.py
imports: import cntk
  import numpy
  import pytest
  import os
  import re
  import shutil
  import time
  import tempfile
  from onnx import numpy_helper
  from .onnx_verify_helper import generate_sequence_data, generate_sequential_data, generate_sparse_data, verify_results_with_onnxruntime, generate_sparse_data_non_seq
  from .onnx_test_helper import find_onnx_value_info_proto_with_matching_name, save_cntk_data_as_onnx_tensor, save_test_data, save_onnx_model_with_validation_data
  from .onnx_op_test import verify_sequence_model
label_desc: Use image node_id 7 for calling a global function with example usage: test_cntk_rnn_models(model_name, use_external_files_to_store_parameters) without return types