onnx_diagnostic.ext_test_case

The module contains the main class ExtTestCase which adds specific functionalities to this project.

class onnx_diagnostic.ext_test_case.ExtTestCase(methodName='runTest')[source]

Inherits from unittest.TestCase and adds specific comprison functions and other helper.

assertAlmostEqual(expected: ndarray, value: ndarray, atol: float = 0, rtol: float = 0)[source]

In the name

assertEmpty(value: Any)[source]

In the name

assertEqual(expected: Any, value: Any, msg: str = '')[source]

Overwrites the error message to get a more explicit message about what is what.

assertEqualArray(expected: Any, value: Any, atol: float = 0, rtol: float = 0, msg: str | None = None)[source]

In the name

assertEqualArrays(expected: Sequence[ndarray], value: Sequence[ndarray], atol: float = 0, rtol: float = 0, msg: str | None = None)[source]

In the name

assertExists(name)[source]

Checks the existing of a file.

assertGreaterOrEqual(a, b, msg=None)[source]

In the name

assertIn(tofind: str, text: str, msg: str = '')[source]

Just like self.assertTrue(a in b), but with a nicer default message.

assertNotEmpty(value: Any)[source]

In the name

assertRaise(fct: Callable, exc_type: type[Exception], msg: str | None = None)[source]

In the name

assertSetContained(set1, set2)[source]

Checks that set1 is contained in set2.

assertStartsWith(prefix: str, full: str)[source]

In the name

assert_onnx_disc(test_name: str, proto: onnx.ModelProto, model: torch.nn.Module, inputs: Tuple[Any] | Dict[str, Any], verbose: int = 0, atol: float = 1e-05, rtol: float = 0.001, copy_inputs: bool = True, expected: Any | None = None, use_ort: bool = False, **kwargs)[source]

Checks for discrepancies. Runs the onnx models, computes expected outputs, in that order. The inputs may be modified by this functions if the torch model modifies them inplace.

Parameters:
  • test_name – test name, dumps the model if not empty

  • proto – onnx model

  • model – torch model

  • inputs – inputs

  • verbose – verbosity

  • atol – absolute tolerance

  • rtol – relative tolerance

  • expected – expected values

  • copy_inputs – to copy the inputs

  • use_ort – use onnxruntime.InferenceSession

  • kwargs – arguments sent to onnx_diagnostic.helpers.ort_session.InferenceSessionForTorch

capture(fct: Callable)[source]

Runs a function and capture standard output and error.

Parameters:

fct – function to run

Returns:

result of fct, output, error

dump_onnx(name: str, proto: Any, folder: str | None = None) str[source]

Dumps an onnx file.

get_dump_file(name: str, folder: str | None = None) str[source]

Returns a filename to dump a model.

print_model(model: ModelProto)[source]

Prints a ModelProto

print_onnx(model: ModelProto)[source]

Prints a ModelProto

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

subloop(*args, verbose: int = 0)[source]

Loops over elements and calls unittests.TestCase.subTest().

classmethod tearDownClass()[source]

Hook method for deconstructing the class fixture after running all tests in the class.

classmethod todo(f: Callable, msg: str)[source]

Adds a todo printed when all test are run.

tryCall(fct: Callable, msg: str | None = None, none_if: str | None = None) Any | None[source]

Calls the function, catch any error.

Parameters:
  • fct – function to call

  • msg – error message to display if failing

  • none_if – returns None if this substring is found in the error message

Returns:

output of fct

onnx_diagnostic.ext_test_case.get_figure(ax)[source]

Returns the figure of a matplotlib figure.

onnx_diagnostic.ext_test_case.has_cuda() bool[source]

Returns torch.cuda.device_count() > 0.

onnx_diagnostic.ext_test_case.has_onnxruntime_training(push_back_batch: bool = False)[source]

Tells if onnxruntime_training is installed.

onnx_diagnostic.ext_test_case.has_onnxscript(version: str, msg: str = '') Callable[source]

Skips a unit test if onnxscript is not recent enough.

onnx_diagnostic.ext_test_case.has_torch(version: str) bool[source]

Returns True if torch transformers is higher.

onnx_diagnostic.ext_test_case.has_transformers(version: str) bool[source]

Returns True if transformers version is higher.

onnx_diagnostic.ext_test_case.hide_stdout(f: Callable | None = None) Callable[source]

Catches warnings, hides standard output. The function may be disabled by setting UNHIDE=1 before running the unit test.

Parameters:

f – the function is called with the stdout as an argument

onnx_diagnostic.ext_test_case.ignore_errors(errors: Exception | Tuple[Exception]) Callable[source]

Catches exception, skip the test if the error is expected sometimes.

Parameters:

errors – errors to ignore

onnx_diagnostic.ext_test_case.ignore_warnings(warns: List[Warning]) Callable[source]

Catches warnings.

Parameters:

warns – warnings to ignore

onnx_diagnostic.ext_test_case.is_azure() bool[source]

Tells if the job is running on Azure DevOps.

onnx_diagnostic.ext_test_case.long_test(msg: str = '') Callable[source]

Skips a unit test if it runs on azure pipeline on Windows.

onnx_diagnostic.ext_test_case.measure_time(stmt: str | Callable, context: Dict[str, Any] | None = None, repeat: int = 10, number: int = 50, warmup: int = 1, div_by_number: bool = True, max_time: float | None = None) Dict[str, str | int | float][source]

Measures a statement and returns the results as a dictionary.

Parameters:
  • stmt – string or callable

  • context – variable to know in a dictionary

  • repeat – average over repeat experiment

  • number – number of executions in one row

  • warmup – number of iteration to do before starting the real measurement

  • div_by_number – divide by the number of executions

  • max_time – execute the statement until the total goes beyond this time (approximately), repeat is ignored, div_by_number must be set to True

Returns:

dictionary

<<<

from pprint import pprint
from math import cos
from onnx_diagnostic.ext_test_case import measure_time

res = measure_time(lambda: cos(0.5))
pprint(res)

>>>

    {'average': np.float64(6.088399459258654e-08),
     'context_size': 64,
     'deviation': np.float64(7.305586099310863e-09),
     'max_exec': np.float64(8.241997420554981e-08),
     'min_exec': np.float64(5.679998139385134e-08),
     'number': 50,
     'repeat': 10,
     'ttime': np.float64(6.088399459258653e-07),
     'warmup_time': 1.4772000213270076e-05}

See Timer.repeat for a better understanding of parameter repeat and number. The function returns a duration corresponding to number times the execution of the main statement.

onnx_diagnostic.ext_test_case.never_test(msg: str = '') Callable[source]

Skips a unit test.

onnx_diagnostic.ext_test_case.requires_cuda(msg: str = '', version: str = '', memory: int = 0)[source]

Skips a test if cuda is not available.

Parameters:
  • msg – to overwrite the message

  • version – minimum version

  • memory – minimum number of Gb to run the test

onnx_diagnostic.ext_test_case.requires_diffusers(version: str, msg: str = '', or_older_than: str | None = None) Callable[source]

Skips a unit test if transformers is not recent enough.

onnx_diagnostic.ext_test_case.requires_numpy(version: str, msg: str = '') Callable[source]

Skips a unit test if numpy is not recent enough.

onnx_diagnostic.ext_test_case.requires_onnx(version: str, msg: str = '') Callable[source]

Skips a unit test if onnx is not recent enough.

onnx_diagnostic.ext_test_case.requires_onnx_array_api(version: str, msg: str = '') Callable[source]

Skips a unit test if onnx-array-api is not recent enough.

onnx_diagnostic.ext_test_case.requires_onnxruntime(version: str, msg: str = '') Callable[source]

Skips a unit test if onnxruntime is not recent enough.

onnx_diagnostic.ext_test_case.requires_onnxruntime_training(push_back_batch: bool = False, ortmodule: bool = False, msg: str = '') Callable[source]

Skips a unit test if onnxruntime is not onnxruntime_training.

onnx_diagnostic.ext_test_case.requires_onnxscript(version: str, msg: str = '') Callable[source]

Skips a unit test if onnxscript is not recent enough.

onnx_diagnostic.ext_test_case.requires_python(version: Tuple[int, ...], msg: str = '')[source]

Skips a test if python is too old.

Parameters:
  • msg – to overwrite the message

  • version – minimum version

onnx_diagnostic.ext_test_case.requires_sklearn(version: str, msg: str = '') Callable[source]

Skips a unit test if scikit-learn is not recent enough.

onnx_diagnostic.ext_test_case.requires_torch(version: str, msg: str = '') Callable[source]

Skips a unit test if pytorch is not recent enough.

onnx_diagnostic.ext_test_case.requires_transformers(version: str, msg: str = '', or_older_than: str | None = None) Callable[source]

Skips a unit test if transformers is not recent enough.

onnx_diagnostic.ext_test_case.requires_zoo(msg: str = '') Callable[source]

Skips a unit test if environment variable ZOO is not equal to 1.

onnx_diagnostic.ext_test_case.skipif_ci_apple(msg) Callable[source]

Skips a unit test if it runs on azure pipeline on Windows.

onnx_diagnostic.ext_test_case.skipif_ci_linux(msg) Callable[source]

Skips a unit test if it runs on azure pipeline on Linux.

onnx_diagnostic.ext_test_case.skipif_ci_windows(msg) Callable[source]

Skips a unit test if it runs on azure pipeline on Windows.

onnx_diagnostic.ext_test_case.statistics_on_file(filename: str) Dict[str, str | int | float][source]

Computes statistics on a file.

<<<

import pprint
from onnx_diagnostic.ext_test_case import statistics_on_file, __file__

pprint.pprint(statistics_on_file(__file__))

>>>

    {'chars': 28114, 'ext': '.py', 'lines': 956}
onnx_diagnostic.ext_test_case.statistics_on_folder(folder: str | List[str], pattern: str = '.*[.]((py|rst))$', aggregation: int = 0) List[Dict[str, str | int | float]][source]

Computes statistics on files in a folder.

Parameters:
  • folder – folder or folders to investigate

  • pattern – file pattern

  • aggregation – show the first subfolders

Returns:

list of dictionaries

<<<

import os
import pprint
from onnx_diagnostic.ext_test_case import statistics_on_folder, __file__

pprint.pprint(statistics_on_folder(os.path.dirname(__file__)))

>>>

    [{'chars': 706, 'ext': '.py', 'lines': 27, 'name': 'doc.py'},
     {'chars': 8708,
      'ext': '.py',
      'lines': 334,
      'name': '_command_lines_parser.py'},
     {'chars': 28114, 'ext': '.py', 'lines': 956, 'name': 'ext_test_case.py'},
     {'chars': 136, 'ext': '.py', 'lines': 4, 'name': '__init__.py'},
     {'chars': 65, 'ext': '.py', 'lines': 3, 'name': '__main__.py'},
     {'chars': 1589,
      'ext': '.py',
      'lines': 46,
      'name': 'tasks/sentence_similarity.py'},
     {'chars': 1640,
      'ext': '.py',
      'lines': 46,
      'name': 'tasks/text_classification.py'},
     {'chars': 3041,
      'ext': '.py',
      'lines': 82,
      'name': 'tasks/zero_shot_image_classification.py'},
     {'chars': 6038,
      'ext': '.py',
      'lines': 175,
      'name': 'tasks/text_generation.py'},
     {'chars': 4243,
      'ext': '.py',
      'lines': 116,
      'name': 'tasks/automatic_speech_recognition.py'},
     {'chars': 1574, 'ext': '.py', 'lines': 46, 'name': 'tasks/fill_mask.py'},
     {'chars': 3946,
      'ext': '.py',
      'lines': 112,
      'name': 'tasks/image_text_to_text.py'},
     {'chars': 2325,
      'ext': '.py',
      'lines': 72,
      'name': 'tasks/image_classification.py'},
     {'chars': 4447,
      'ext': '.py',
      'lines': 123,
      'name': 'tasks/text2text_generation.py'},
     {'chars': 1196, 'ext': '.py', 'lines': 37, 'name': 'tasks/__init__.py'},
     {'chars': 18556, 'ext': '.py', 'lines': 559, 'name': 'helpers/ort_session.py'},
     {'chars': 33300, 'ext': '.py', 'lines': 1245, 'name': 'helpers/helper.py'},
     {'chars': 4898, 'ext': '.py', 'lines': 131, 'name': 'helpers/cache_helper.py'},
     {'chars': 2878, 'ext': '.py', 'lines': 115, 'name': 'helpers/args_helper.py'},
     {'chars': 9286,
      'ext': '.py',
      'lines': 289,
      'name': 'helpers/torch_test_helper.py'},
     {'chars': 1379, 'ext': '.py', 'lines': 39, 'name': 'helpers/rt_helper.py'},
     {'chars': 2016, 'ext': '.py', 'lines': 65, 'name': 'helpers/config_helper.py'},
     {'chars': 11256, 'ext': '.py', 'lines': 393, 'name': 'helpers/bench_run.py'},
     {'chars': 20798, 'ext': '.py', 'lines': 746, 'name': 'helpers/onnx_helper.py'},
     {'chars': 60, 'ext': '.py', 'lines': 1, 'name': 'helpers/__init__.py'},
     {'chars': 4328, 'ext': '.py', 'lines': 187, 'name': 'helpers/memory_peak.py'},
     {'chars': 751,
      'ext': '.py',
      'lines': 34,
      'name': 'reference/quantized_tensor.py'},
     {'chars': 11323,
      'ext': '.py',
      'lines': 360,
      'name': 'reference/ort_evaluator.py'},
     {'chars': 6199, 'ext': '.py', 'lines': 219, 'name': 'reference/evaluator.py'},
     {'chars': 90, 'ext': '.py', 'lines': 2, 'name': 'reference/__init__.py'},
     {'chars': 439,
      'ext': '.py',
      'lines': 20,
      'name': 'reference/ops/op_complex.py'},
     {'chars': 647,
      'ext': '.py',
      'lines': 27,
      'name': 'reference/ops/op_fused_matmul.py'},
     {'chars': 380,
      'ext': '.py',
      'lines': 14,
      'name': 'reference/ops/op_tri_matrix.py'},
     {'chars': 458,
      'ext': '.py',
      'lines': 17,
      'name': 'reference/ops/op_quick_gelu.py'},
     {'chars': 531, 'ext': '.py', 'lines': 15, 'name': 'reference/ops/op_slice.py'},
     {'chars': 2582,
      'ext': '.py',
      'lines': 88,
      'name': 'reference/ops/op_qlinear_conv.py'},
     {'chars': 1161,
      'ext': '.py',
      'lines': 59,
      'name': 'reference/ops/op_constant_of_shape.py'},
     {'chars': 667,
      'ext': '.py',
      'lines': 16,
      'name': 'reference/ops/op_scatternd_of_shape.py'},
     {'chars': 147,
      'ext': '.py',
      'lines': 5,
      'name': 'reference/ops/op_negxplus1.py'},
     {'chars': 220,
      'ext': '.py',
      'lines': 6,
      'name': 'reference/ops/op_simplified_layer_normalization.py'},
     {'chars': 295,
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_transpose_cast.py'},
     {'chars': 140,
      'ext': '.py',
      'lines': 7,
      'name': 'reference/ops/op_memcpy_host.py'},
     {'chars': 1405,
      'ext': '.py',
      'lines': 51,
      'name': 'reference/ops/op_average_pool_grad.py'},
     {'chars': 317,
      'ext': '.py',
      'lines': 9,
      'name': 'reference/ops/op_gather_grad.py'},
     {'chars': 853,
      'ext': '.py',
      'lines': 35,
      'name': 'reference/ops/op_qlinear_average_pool.py'},
     {'chars': 684,
      'ext': '.py',
      'lines': 24,
      'name': 'reference/ops/op_gather.py'},
     {'chars': 1419,
      'ext': '.py',
      'lines': 52,
      'name': 'reference/ops/op_attention.py'},
     {'chars': 384,
      'ext': '.py',
      'lines': 13,
      'name': 'reference/ops/op_bias_softmax.py'},
     {'chars': 224,
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_replace_zero.py'},
     {'chars': 350,
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_skip_layer_normalization.py'},
     {'chars': 455,
      'ext': '.py',
      'lines': 17,
      'name': 'reference/ops/op_mul_sigmoid.py'},
     {'chars': 0, 'ext': '.py', 'lines': 0, 'name': 'reference/ops/__init__.py'},
     {'chars': 1139,
      'ext': '.py',
      'lines': 33,
      'name': 'reference/ops/op_gather_elements.py'},
     {'chars': 434,
      'ext': '.py',
      'lines': 16,
      'name': 'reference/ops/op_rotary.py'},
     {'chars': 383,
      'ext': '.py',
      'lines': 11,
      'name': 'reference/ops/op_concat.py'},
     {'chars': 1091,
      'ext': '.py',
      'lines': 44,
      'name': 'reference/ops/op_add_add_mul_mul.py'},
     {'chars': 2202,
      'ext': '.py',
      'lines': 82,
      'name': 'reference/ops/op_scatter_elements.py'},
     {'chars': 1001,
      'ext': '.py',
      'lines': 31,
      'name': 'reference/ops/op_cast_like.py'},
     {'chars': 0, 'ext': '.py', 'lines': 0, 'name': 'torch_onnx/__init__.py'},
     {'chars': 11207, 'ext': '.py', 'lines': 349, 'name': 'torch_onnx/sbs.py'},
     {'chars': 4358, 'ext': '.py', 'lines': 140, 'name': 'export/validate.py'},
     {'chars': 24576,
      'ext': '.py',
      'lines': 780,
      'name': 'export/dynamic_shapes.py'},
     {'chars': 92, 'ext': '.py', 'lines': 2, 'name': 'export/__init__.py'},
     {'chars': 10290,
      'ext': '.py',
      'lines': 268,
      'name': 'torch_export_patches/onnx_export_serialization.py'},
     {'chars': 5018,
      'ext': '.py',
      'lines': 168,
      'name': 'torch_export_patches/patch_inputs.py'},
     {'chars': 101,
      'ext': '.py',
      'lines': 3,
      'name': 'torch_export_patches/__init__.py'},
     {'chars': 11395,
      'ext': '.py',
      'lines': 310,
      'name': 'torch_export_patches/onnx_export_errors.py'},
     {'chars': 14511,
      'ext': '.py',
      'lines': 395,
      'name': 'torch_export_patches/patches/patch_transformers.py'},
     {'chars': 10310,
      'ext': '.py',
      'lines': 309,
      'name': 'torch_export_patches/patches/patch_torch.py'},
     {'chars': 0,
      'ext': '.py',
      'lines': 0,
      'name': 'torch_export_patches/patches/__init__.py'},
     {'chars': 33638,
      'ext': '.py',
      'lines': 1061,
      'name': 'torch_models/test_helper.py'},
     {'chars': 0, 'ext': '.py', 'lines': 0, 'name': 'torch_models/__init__.py'},
     {'chars': 82, 'ext': '.py', 'lines': 2, 'name': 'torch_models/llms.py'},
     {'chars': 5579,
      'ext': '.py',
      'lines': 193,
      'name': 'torch_models/hghub/hub_api.py'},
     {'chars': 4232,
      'ext': '.py',
      'lines': 122,
      'name': 'torch_models/hghub/model_inputs.py'},
     {'chars': 215532,
      'ext': '.py',
      'lines': 3403,
      'name': 'torch_models/hghub/hub_data_cached_configs.py'},
     {'chars': 6516,
      'ext': '.py',
      'lines': 186,
      'name': 'torch_models/hghub/hub_data.py'},
     {'chars': 54,
      'ext': '.py',
      'lines': 1,
      'name': 'torch_models/hghub/__init__.py'},
     {'chars': 2642,
      'ext': '.py',
      'lines': 84,
      'name': 'torch_models/untrained/llm_phi2.py'},
     {'chars': 2509,
      'ext': '.py',
      'lines': 78,
      'name': 'torch_models/untrained/llm_tiny_llm.py'},
     {'chars': 0,
      'ext': '.py',
      'lines': 0,
      'name': 'torch_models/untrained/__init__.py'}]

Aggregated:

<<<

import os
import pprint
from onnx_diagnostic.ext_test_case import statistics_on_folder, __file__

pprint.pprint(statistics_on_folder(os.path.dirname(__file__), aggregation=1))

>>>

    [{'chars': 706, 'dir': '', 'ext': '.py', 'lines': 27, 'name': 'doc.py'},
     {'chars': 8708,
      'dir': '',
      'ext': '.py',
      'lines': 334,
      'name': '_command_lines_parser.py'},
     {'chars': 28114,
      'dir': '',
      'ext': '.py',
      'lines': 956,
      'name': 'ext_test_case.py'},
     {'chars': 136, 'dir': '', 'ext': '.py', 'lines': 4, 'name': '__init__.py'},
     {'chars': 65, 'dir': '', 'ext': '.py', 'lines': 3, 'name': '__main__.py'},
     {'chars': 1589,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 46,
      'name': 'tasks/sentence_similarity.py'},
     {'chars': 1640,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 46,
      'name': 'tasks/text_classification.py'},
     {'chars': 3041,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 82,
      'name': 'tasks/zero_shot_image_classification.py'},
     {'chars': 6038,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 175,
      'name': 'tasks/text_generation.py'},
     {'chars': 4243,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 116,
      'name': 'tasks/automatic_speech_recognition.py'},
     {'chars': 1574,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 46,
      'name': 'tasks/fill_mask.py'},
     {'chars': 3946,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 112,
      'name': 'tasks/image_text_to_text.py'},
     {'chars': 2325,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 72,
      'name': 'tasks/image_classification.py'},
     {'chars': 4447,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 123,
      'name': 'tasks/text2text_generation.py'},
     {'chars': 1196,
      'dir': 'tasks',
      'ext': '.py',
      'lines': 37,
      'name': 'tasks/__init__.py'},
     {'chars': 18556,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 559,
      'name': 'helpers/ort_session.py'},
     {'chars': 33300,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 1245,
      'name': 'helpers/helper.py'},
     {'chars': 4898,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 131,
      'name': 'helpers/cache_helper.py'},
     {'chars': 2878,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 115,
      'name': 'helpers/args_helper.py'},
     {'chars': 9286,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 289,
      'name': 'helpers/torch_test_helper.py'},
     {'chars': 1379,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 39,
      'name': 'helpers/rt_helper.py'},
     {'chars': 2016,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 65,
      'name': 'helpers/config_helper.py'},
     {'chars': 11256,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 393,
      'name': 'helpers/bench_run.py'},
     {'chars': 20798,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 746,
      'name': 'helpers/onnx_helper.py'},
     {'chars': 60,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 1,
      'name': 'helpers/__init__.py'},
     {'chars': 4328,
      'dir': 'helpers',
      'ext': '.py',
      'lines': 187,
      'name': 'helpers/memory_peak.py'},
     {'chars': 751,
      'dir': 'reference',
      'ext': '.py',
      'lines': 34,
      'name': 'reference/quantized_tensor.py'},
     {'chars': 11323,
      'dir': 'reference',
      'ext': '.py',
      'lines': 360,
      'name': 'reference/ort_evaluator.py'},
     {'chars': 6199,
      'dir': 'reference',
      'ext': '.py',
      'lines': 219,
      'name': 'reference/evaluator.py'},
     {'chars': 90,
      'dir': 'reference',
      'ext': '.py',
      'lines': 2,
      'name': 'reference/__init__.py'},
     {'chars': 439,
      'dir': 'reference',
      'ext': '.py',
      'lines': 20,
      'name': 'reference/ops/op_complex.py'},
     {'chars': 647,
      'dir': 'reference',
      'ext': '.py',
      'lines': 27,
      'name': 'reference/ops/op_fused_matmul.py'},
     {'chars': 380,
      'dir': 'reference',
      'ext': '.py',
      'lines': 14,
      'name': 'reference/ops/op_tri_matrix.py'},
     {'chars': 458,
      'dir': 'reference',
      'ext': '.py',
      'lines': 17,
      'name': 'reference/ops/op_quick_gelu.py'},
     {'chars': 531,
      'dir': 'reference',
      'ext': '.py',
      'lines': 15,
      'name': 'reference/ops/op_slice.py'},
     {'chars': 2582,
      'dir': 'reference',
      'ext': '.py',
      'lines': 88,
      'name': 'reference/ops/op_qlinear_conv.py'},
     {'chars': 1161,
      'dir': 'reference',
      'ext': '.py',
      'lines': 59,
      'name': 'reference/ops/op_constant_of_shape.py'},
     {'chars': 667,
      'dir': 'reference',
      'ext': '.py',
      'lines': 16,
      'name': 'reference/ops/op_scatternd_of_shape.py'},
     {'chars': 147,
      'dir': 'reference',
      'ext': '.py',
      'lines': 5,
      'name': 'reference/ops/op_negxplus1.py'},
     {'chars': 220,
      'dir': 'reference',
      'ext': '.py',
      'lines': 6,
      'name': 'reference/ops/op_simplified_layer_normalization.py'},
     {'chars': 295,
      'dir': 'reference',
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_transpose_cast.py'},
     {'chars': 140,
      'dir': 'reference',
      'ext': '.py',
      'lines': 7,
      'name': 'reference/ops/op_memcpy_host.py'},
     {'chars': 1405,
      'dir': 'reference',
      'ext': '.py',
      'lines': 51,
      'name': 'reference/ops/op_average_pool_grad.py'},
     {'chars': 317,
      'dir': 'reference',
      'ext': '.py',
      'lines': 9,
      'name': 'reference/ops/op_gather_grad.py'},
     {'chars': 853,
      'dir': 'reference',
      'ext': '.py',
      'lines': 35,
      'name': 'reference/ops/op_qlinear_average_pool.py'},
     {'chars': 684,
      'dir': 'reference',
      'ext': '.py',
      'lines': 24,
      'name': 'reference/ops/op_gather.py'},
     {'chars': 1419,
      'dir': 'reference',
      'ext': '.py',
      'lines': 52,
      'name': 'reference/ops/op_attention.py'},
     {'chars': 384,
      'dir': 'reference',
      'ext': '.py',
      'lines': 13,
      'name': 'reference/ops/op_bias_softmax.py'},
     {'chars': 224,
      'dir': 'reference',
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_replace_zero.py'},
     {'chars': 350,
      'dir': 'reference',
      'ext': '.py',
      'lines': 10,
      'name': 'reference/ops/op_skip_layer_normalization.py'},
     {'chars': 455,
      'dir': 'reference',
      'ext': '.py',
      'lines': 17,
      'name': 'reference/ops/op_mul_sigmoid.py'},
     {'chars': 0,
      'dir': 'reference',
      'ext': '.py',
      'lines': 0,
      'name': 'reference/ops/__init__.py'},
     {'chars': 1139,
      'dir': 'reference',
      'ext': '.py',
      'lines': 33,
      'name': 'reference/ops/op_gather_elements.py'},
     {'chars': 434,
      'dir': 'reference',
      'ext': '.py',
      'lines': 16,
      'name': 'reference/ops/op_rotary.py'},
     {'chars': 383,
      'dir': 'reference',
      'ext': '.py',
      'lines': 11,
      'name': 'reference/ops/op_concat.py'},
     {'chars': 1091,
      'dir': 'reference',
      'ext': '.py',
      'lines': 44,
      'name': 'reference/ops/op_add_add_mul_mul.py'},
     {'chars': 2202,
      'dir': 'reference',
      'ext': '.py',
      'lines': 82,
      'name': 'reference/ops/op_scatter_elements.py'},
     {'chars': 1001,
      'dir': 'reference',
      'ext': '.py',
      'lines': 31,
      'name': 'reference/ops/op_cast_like.py'},
     {'chars': 0,
      'dir': 'torch_onnx',
      'ext': '.py',
      'lines': 0,
      'name': 'torch_onnx/__init__.py'},
     {'chars': 11207,
      'dir': 'torch_onnx',
      'ext': '.py',
      'lines': 349,
      'name': 'torch_onnx/sbs.py'},
     {'chars': 4358,
      'dir': 'export',
      'ext': '.py',
      'lines': 140,
      'name': 'export/validate.py'},
     {'chars': 24576,
      'dir': 'export',
      'ext': '.py',
      'lines': 780,
      'name': 'export/dynamic_shapes.py'},
     {'chars': 92,
      'dir': 'export',
      'ext': '.py',
      'lines': 2,
      'name': 'export/__init__.py'},
     {'chars': 10290,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 268,
      'name': 'torch_export_patches/onnx_export_serialization.py'},
     {'chars': 5018,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 168,
      'name': 'torch_export_patches/patch_inputs.py'},
     {'chars': 101,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 3,
      'name': 'torch_export_patches/__init__.py'},
     {'chars': 11395,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 310,
      'name': 'torch_export_patches/onnx_export_errors.py'},
     {'chars': 14511,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 395,
      'name': 'torch_export_patches/patches/patch_transformers.py'},
     {'chars': 10310,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 309,
      'name': 'torch_export_patches/patches/patch_torch.py'},
     {'chars': 0,
      'dir': 'torch_export_patches',
      'ext': '.py',
      'lines': 0,
      'name': 'torch_export_patches/patches/__init__.py'},
     {'chars': 33638,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 1061,
      'name': 'torch_models/test_helper.py'},
     {'chars': 0,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 0,
      'name': 'torch_models/__init__.py'},
     {'chars': 82,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 2,
      'name': 'torch_models/llms.py'},
     {'chars': 5579,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 193,
      'name': 'torch_models/hghub/hub_api.py'},
     {'chars': 4232,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 122,
      'name': 'torch_models/hghub/model_inputs.py'},
     {'chars': 215532,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 3403,
      'name': 'torch_models/hghub/hub_data_cached_configs.py'},
     {'chars': 6516,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 186,
      'name': 'torch_models/hghub/hub_data.py'},
     {'chars': 54,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 1,
      'name': 'torch_models/hghub/__init__.py'},
     {'chars': 2642,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 84,
      'name': 'torch_models/untrained/llm_phi2.py'},
     {'chars': 2509,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 78,
      'name': 'torch_models/untrained/llm_tiny_llm.py'},
     {'chars': 0,
      'dir': 'torch_models',
      'ext': '.py',
      'lines': 0,
      'name': 'torch_models/untrained/__init__.py'}]
onnx_diagnostic.ext_test_case.unit_test_going()[source]

Enables a flag telling the script is running while testing it. Avois unit tests to be very long.