diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__init__.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..834dbce32f10bfb339fd2182a2455b43914441c9 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__init__.py @@ -0,0 +1,61 @@ +# mypy: allow-untyped-defs +import dataclasses +import glob +import inspect +from os.path import basename, dirname, isfile, join + +import torch +from torch._export.db.case import ( + _EXAMPLE_CASES, + _EXAMPLE_CONFLICT_CASES, + _EXAMPLE_REWRITE_CASES, + SupportLevel, + export_case, + ExportCase, +) + + +def _collect_examples(): + case_names = glob.glob(join(dirname(__file__), "*.py")) + case_names = [ + basename(f)[:-3] for f in case_names if isfile(f) and not f.endswith("__init__.py") + ] + + case_fields = {f.name for f in dataclasses.fields(ExportCase)} + for case_name in case_names: + case = __import__(case_name, globals(), locals(), [], 1) + variables = [name for name in dir(case) if name in case_fields] + export_case(**{v: getattr(case, v) for v in variables})(case.model) + +_collect_examples() + +def all_examples(): + return _EXAMPLE_CASES + + +if len(_EXAMPLE_CONFLICT_CASES) > 0: + + def get_name(case): + model = case.model + if isinstance(model, torch.nn.Module): + model = type(model) + return model.__name__ + + msg = "Error on conflict export case name.\n" + for case_name, cases in _EXAMPLE_CONFLICT_CASES.items(): + msg += f"Case name {case_name} is associated with multiple cases:\n " + msg += f"[{','.join(map(get_name, cases))}]\n" + + raise RuntimeError(msg) + + +def filter_examples_by_support_level(support_level: SupportLevel): + return { + key: val + for key, val in all_examples().items() + if val.support_level == support_level + } + + +def get_rewrite_cases(case): + return _EXAMPLE_REWRITE_CASES.get(case.name, []) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/__init__.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..15e605a11c82828441ffedef9135641281f3b1f3 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/__init__.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/assume_constant_result.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/assume_constant_result.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1af7b48c0ec45c87339d73f9eea579a26c38f828 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/assume_constant_result.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/autograd_function.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/autograd_function.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6c12b24e73bb6ec73d54aa05c24c31ff1428f65 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/autograd_function.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/class_method.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/class_method.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a25a70a486636baec37497ce30ba0e945dd8f9d Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/class_method.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_class_method.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_class_method.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ffad52ffa7b4a3b73bfe79fd81bcf2117b245df7 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_class_method.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nested_function.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nested_function.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a5ff99c7107dc6365f267f5c0f6e9ad21450e5d9 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nested_function.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nonlocal_variables.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nonlocal_variables.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..48176a7847e045715552e5b3e455cfcc27181d5f Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_branch_nonlocal_variables.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_closed_over_variable.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_closed_over_variable.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..db06fce99ca6171c458748aa1336b15cec008c47 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_closed_over_variable.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_operands.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_operands.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..abbc612023a044c103770582785755eeb6c3128a Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_operands.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_predicate.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_predicate.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0951e870574e96915152b18ae71bd06a3e75d40 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/cond_predicate.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_size_example.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_size_example.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3bc94db51edbf2bd170e941bb815b513d253cafe Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_size_example.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_value_example.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_value_example.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b15a44ab57adf02793ab8b104a871deede0e0c5e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/constrain_as_value_example.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/decorator.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/decorator.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c6ef9034a76a0481ae25ee119df96b73d753cbe7 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/decorator.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dictionary.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dictionary.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..43b04b32a25da50a7715bf5eaf581b9d447efce5 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dictionary.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_assert.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_assert.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a05c98e63faf09f016c1734af068a61c57324571 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_assert.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_constructor.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_constructor.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..13f6e3663e2d8d285f6a849ea55512f3083e6b88 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_constructor.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_if_guard.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_if_guard.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1760eda209ed66362b9978636de90122750e1ae9 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_if_guard.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_map.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_map.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6823de6d54ceaaa098dbc666ad904df7fbe73631 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_map.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_round.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_round.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c0a70b9a9f8e38a877bd1e56bf651f1a781c08fc Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_round.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_slicing.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_slicing.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1088fddaac6426ad83f30306a92ea8522270ade1 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_slicing.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_view.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_view.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4b5aa50c095e6eb40c5720b17d2b88057383023b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/dynamic_shape_view.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/fn_with_kwargs.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/fn_with_kwargs.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..180d2f9d1c4dc983cfc7ba6cd0b9784917e9a8ff Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/fn_with_kwargs.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_contains.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_contains.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7aa5872a7c9aae8f5ed47391f88f5d6768dd9ed5 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_contains.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_unpack.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_unpack.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..51df45d6a0e769bfebffe8deb33f0946cc920978 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/list_unpack.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/model_attr_mutation.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/model_attr_mutation.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca65696d1dc72b9c4f0229005b63b2a870f6caf3 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/model_attr_mutation.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/nested_function.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/nested_function.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6a902050f5fa6b7abdcc1b58dcee1de3760f420b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/nested_function.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/null_context_manager.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/null_context_manager.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6992f03d3d3b826446999de5e671265dc9f1a088 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/null_context_manager.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/optional_input.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/optional_input.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..08c1e442a8029da9b512e957084b1b624636989c Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/optional_input.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/pytree_flatten.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/pytree_flatten.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d9bbc6e2f005440a741bd286ad7e3ceac78c344 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/pytree_flatten.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/scalar_output.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/scalar_output.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b00c6d1b5af01c9eb97ed2e1dc7c71f4412592d8 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/scalar_output.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/specialized_attribute.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/specialized_attribute.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b0e6342c6fcc56620dd285881d646456b6056d11 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/specialized_attribute.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_for_loop.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_for_loop.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b010e3383ae6a50945d60050608209ffdeec8fd4 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_for_loop.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_if.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_if.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fd3a5ddd685887e6c5ece960cb2647b117d109c6 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/static_if.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/tensor_setattr.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/tensor_setattr.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0efbf9054ff37b314bab278283f37f49782a4b38 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/tensor_setattr.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/type_reflection_method.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/type_reflection_method.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3d11b77d40c7d75c81299ea46a6e9b4813447a32 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/type_reflection_method.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/unsupported_operator.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/unsupported_operator.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..91338c898ee218c491e8fafdf7ce4467e9b80527 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/unsupported_operator.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/user_input_mutation.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/user_input_mutation.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a814e84235dbd4c9b0ee3bb3681031016b520a2f Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/__pycache__/user_input_mutation.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/assume_constant_result.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/assume_constant_result.py new file mode 100644 index 0000000000000000000000000000000000000000..931ce7f7a50fc5a175101ac57c424c88cf31b54c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/assume_constant_result.py @@ -0,0 +1,20 @@ +# mypy: allow-untyped-defs +import torch +import torch._dynamo as torchdynamo + + +class AssumeConstantResult(torch.nn.Module): + """ + Applying `assume_constant_result` decorator to burn make non-tracable code as constant. + """ + + @torchdynamo.assume_constant_result + def get_item(self, y): + return y.int().item() + + def forward(self, x, y): + return x[: self.get_item(y)] + +example_args = (torch.randn(3, 2), torch.tensor(4)) +tags = {"torch.escape-hatch"} +model = AssumeConstantResult() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/autograd_function.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/autograd_function.py new file mode 100644 index 0000000000000000000000000000000000000000..0458291e2176932b32b0fc2e44d51d5812dcead3 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/autograd_function.py @@ -0,0 +1,23 @@ +# mypy: allow-untyped-defs +import torch + +class MyAutogradFunction(torch.autograd.Function): + @staticmethod + def forward(ctx, x): + return x.clone() + + @staticmethod + def backward(ctx, grad_output): + return grad_output + 1 + +class AutogradFunction(torch.nn.Module): + """ + TorchDynamo does not keep track of backward() on autograd functions. We recommend to + use `allow_in_graph` to mitigate this problem. + """ + + def forward(self, x): + return MyAutogradFunction.apply(x) + +example_args = (torch.randn(3, 2),) +model = AutogradFunction() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/class_method.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/class_method.py new file mode 100644 index 0000000000000000000000000000000000000000..f701f54d4f4ea1cb5816292cd60bb4df3d03c5e8 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/class_method.py @@ -0,0 +1,22 @@ +# mypy: allow-untyped-defs +import torch + +class ClassMethod(torch.nn.Module): + """ + Class methods are inlined during tracing. + """ + + @classmethod + def method(cls, x): + return x + 1 + + def __init__(self) -> None: + super().__init__() + self.linear = torch.nn.Linear(4, 2) + + def forward(self, x): + x = self.linear(x) + return self.method(x) * self.__class__.method(x) * type(self).method(x) + +example_args = (torch.randn(3, 4),) +model = ClassMethod() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_branch_class_method.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_branch_class_method.py new file mode 100644 index 0000000000000000000000000000000000000000..22600cc504348d1d261b0ea2b9ed2d57af76b0a3 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_branch_class_method.py @@ -0,0 +1,44 @@ +# mypy: allow-untyped-defs +import torch + +from functorch.experimental.control_flow import cond + +class MySubModule(torch.nn.Module): + def foo(self, x): + return x.cos() + + def forward(self, x): + return self.foo(x) + +class CondBranchClassMethod(torch.nn.Module): + """ + The branch functions (`true_fn` and `false_fn`) passed to cond() must follow these rules: + - both branches must take the same args, which must also match the branch args passed to cond. + - both branches must return a single tensor + - returned tensor must have the same tensor metadata, e.g. shape and dtype + - branch function can be free function, nested function, lambda, class methods + - branch function can not have closure variables + - no inplace mutations on inputs or global variables + + + This example demonstrates using class method in cond(). + + NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized. + """ + + def __init__(self) -> None: + super().__init__() + self.subm = MySubModule() + + def bar(self, x): + return x.sin() + + def forward(self, x): + return cond(x.shape[0] <= 2, self.subm.forward, self.bar, [x]) + +example_args = (torch.randn(3),) +tags = { + "torch.cond", + "torch.dynamic-shape", +} +model = CondBranchClassMethod() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_closed_over_variable.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_closed_over_variable.py new file mode 100644 index 0000000000000000000000000000000000000000..183180ab4fc825385170fea2bec6af184374a67e --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_closed_over_variable.py @@ -0,0 +1,22 @@ +# mypy: allow-untyped-defs +import torch + +from functorch.experimental.control_flow import cond + +class CondClosedOverVariable(torch.nn.Module): + """ + torch.cond() supports branches closed over arbitrary variables. + """ + + def forward(self, pred, x): + def true_fn(val): + return x * 2 + + def false_fn(val): + return x - 2 + + return cond(pred, true_fn, false_fn, [x + 1]) + +example_args = (torch.tensor(True), torch.randn(3, 2)) +tags = {"torch.cond", "python.closure"} +model = CondClosedOverVariable() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_operands.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_operands.py new file mode 100644 index 0000000000000000000000000000000000000000..60a75d24639cdac991298e99acf96b8eadbff442 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_operands.py @@ -0,0 +1,35 @@ +# mypy: allow-untyped-defs +import torch + +from torch.export import Dim + +x = torch.randn(3, 2) +y = torch.randn(2) +dim0_x = Dim("dim0_x") + +class CondOperands(torch.nn.Module): + """ + The operands passed to cond() must be: + - a list of tensors + - match arguments of `true_fn` and `false_fn` + + NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized. + """ + + def forward(self, x, y): + def true_fn(x, y): + return x + y + + def false_fn(x, y): + return x - y + + return torch.cond(x.shape[0] > 2, true_fn, false_fn, [x, y]) + +example_args = (x, y) +tags = { + "torch.cond", + "torch.dynamic-shape", +} +extra_inputs = (torch.randn(2, 2), torch.randn(2)) +dynamic_shapes = {"x": {0: dim0_x}, "y": None} +model = CondOperands() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_predicate.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_predicate.py new file mode 100644 index 0000000000000000000000000000000000000000..68bb8850bba909a0c6546c8f12a1a3fa1bdc70d1 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/cond_predicate.py @@ -0,0 +1,25 @@ +# mypy: allow-untyped-defs +import torch + +from functorch.experimental.control_flow import cond + +class CondPredicate(torch.nn.Module): + """ + The conditional statement (aka predicate) passed to cond() must be one of the following: + - torch.Tensor with a single element + - boolean expression + + NOTE: If the `pred` is test on a dim with batch size < 2, it will be specialized. + """ + + def forward(self, x): + pred = x.dim() > 2 and x.shape[2] > 10 + + return cond(pred, lambda x: x.cos(), lambda y: y.sin(), [x]) + +example_args = (torch.randn(6, 4, 3),) +tags = { + "torch.cond", + "torch.dynamic-shape", +} +model = CondPredicate() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_size_example.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_size_example.py new file mode 100644 index 0000000000000000000000000000000000000000..fbed4984ac4d14c0b175874c44e9c7009bfe8ddc --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_size_example.py @@ -0,0 +1,25 @@ +# mypy: allow-untyped-defs +import torch + + +class ConstrainAsSizeExample(torch.nn.Module): + """ + If the value is not known at tracing time, you can provide hint so that we + can trace further. Please look at torch._check and torch._check_is_size APIs. + torch._check_is_size is used for values that NEED to be used for constructing + tensor. + """ + + def forward(self, x): + a = x.item() + torch._check_is_size(a) + torch._check(a <= 5) + return torch.zeros((a, 5)) + + +example_args = (torch.tensor(4),) +tags = { + "torch.dynamic-value", + "torch.escape-hatch", +} +model = ConstrainAsSizeExample() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_value_example.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_value_example.py new file mode 100644 index 0000000000000000000000000000000000000000..c8bfc3d6e36578ee50f1ca2eee80fed9aae14cfd --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/constrain_as_value_example.py @@ -0,0 +1,28 @@ +# mypy: allow-untyped-defs +import torch + + +class ConstrainAsValueExample(torch.nn.Module): + """ + If the value is not known at tracing time, you can provide hint so that we + can trace further. Please look at torch._check and torch._check_is_size APIs. + torch._check is used for values that don't need to be used for constructing + tensor. + """ + + def forward(self, x, y): + a = x.item() + torch._check(a >= 0) + torch._check(a <= 5) + + if a < 6: + return y.sin() + return y.cos() + + +example_args = (torch.tensor(4), torch.randn(5, 5)) +tags = { + "torch.dynamic-value", + "torch.escape-hatch", +} +model = ConstrainAsValueExample() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/decorator.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/decorator.py new file mode 100644 index 0000000000000000000000000000000000000000..7d24cc681a6b62adf40bfd9a2e5283afb3515131 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/decorator.py @@ -0,0 +1,23 @@ +# mypy: allow-untyped-defs +import functools + +import torch + +def test_decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + return func(*args, **kwargs) + 1 + + return wrapper + +class Decorator(torch.nn.Module): + """ + Decorators calls are inlined into the exported function during tracing. + """ + + @test_decorator + def forward(self, x, y): + return x + y + +example_args = (torch.randn(3, 2), torch.randn(3, 2)) +model = Decorator() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dictionary.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dictionary.py new file mode 100644 index 0000000000000000000000000000000000000000..49e688bc0ac1f09567e3b877aaca29a1d02b4121 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dictionary.py @@ -0,0 +1,17 @@ +# mypy: allow-untyped-defs +import torch + +class Dictionary(torch.nn.Module): + """ + Dictionary structures are inlined and flattened along tracing. + """ + + def forward(self, x, y): + elements = {} + elements["x2"] = x * x + y = y * elements["x2"] + return {"y": y} + +example_args = (torch.randn(3, 2), torch.tensor(4)) +tags = {"python.data-structure"} +model = Dictionary() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_assert.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_assert.py new file mode 100644 index 0000000000000000000000000000000000000000..cc822e5553e1ab8bd350a26966c22f1a9a1698cf --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_assert.py @@ -0,0 +1,18 @@ +# mypy: allow-untyped-defs +import torch + +class DynamicShapeAssert(torch.nn.Module): + """ + A basic usage of python assertion. + """ + + def forward(self, x): + # assertion with error message + assert x.shape[0] > 2, f"{x.shape[0]} is greater than 2" + # assertion without error message + assert x.shape[0] > 1 + return x + +example_args = (torch.randn(3, 2),) +tags = {"python.assert"} +model = DynamicShapeAssert() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_if_guard.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_if_guard.py new file mode 100644 index 0000000000000000000000000000000000000000..21824ef3a0f66eb25f4d8e8c1ba92f53fdd4c275 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_if_guard.py @@ -0,0 +1,19 @@ +# mypy: allow-untyped-defs +import torch + +class DynamicShapeIfGuard(torch.nn.Module): + """ + `if` statement with backed dynamic shape predicate will be specialized into + one particular branch and generate a guard. However, export will fail if the + the dimension is marked as dynamic shape from higher level API. + """ + + def forward(self, x): + if x.shape[0] == 3: + return x.cos() + + return x.sin() + +example_args = (torch.randn(3, 2, 2),) +tags = {"torch.dynamic-shape", "python.control-flow"} +model = DynamicShapeIfGuard() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_map.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_map.py new file mode 100644 index 0000000000000000000000000000000000000000..f8066aed556b9ee588b9744d17ba16c35d8fed6c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_map.py @@ -0,0 +1,19 @@ +# mypy: allow-untyped-defs +import torch + +from functorch.experimental.control_flow import map + +class DynamicShapeMap(torch.nn.Module): + """ + functorch map() maps a function over the first tensor dimension. + """ + + def forward(self, xs, y): + def body(x, y): + return x + y + + return map(body, xs, y) + +example_args = (torch.randn(3, 2), torch.randn(2)) +tags = {"torch.dynamic-shape", "torch.map"} +model = DynamicShapeMap() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_round.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_round.py new file mode 100644 index 0000000000000000000000000000000000000000..decbf036553cb76544a19e531e5aee98d792ae0b --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_round.py @@ -0,0 +1,21 @@ +# mypy: allow-untyped-defs +import torch + +from torch._export.db.case import SupportLevel +from torch.export import Dim + +class DynamicShapeRound(torch.nn.Module): + """ + Calling round on dynamic shapes is not supported. + """ + + def forward(self, x): + return x[: round(x.shape[0] / 2)] + +x = torch.randn(3, 2) +dim0_x = Dim("dim0_x") +example_args = (x,) +tags = {"torch.dynamic-shape", "python.builtin"} +support_level = SupportLevel.NOT_SUPPORTED_YET +dynamic_shapes = {"x": {0: dim0_x}} +model = DynamicShapeRound() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_slicing.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_slicing.py new file mode 100644 index 0000000000000000000000000000000000000000..360fe15f6f98d9d735366bfa53371d79e0b00209 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_slicing.py @@ -0,0 +1,15 @@ +# mypy: allow-untyped-defs +import torch + +class DynamicShapeSlicing(torch.nn.Module): + """ + Slices with dynamic shape arguments should be captured into the graph + rather than being baked in. + """ + + def forward(self, x): + return x[: x.shape[0] - 2, x.shape[1] - 1 :: 2] + +example_args = (torch.randn(3, 2),) +tags = {"torch.dynamic-shape"} +model = DynamicShapeSlicing() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_view.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_view.py new file mode 100644 index 0000000000000000000000000000000000000000..c45d4aeebb0282a0f56c58a587b4bfe1655f50e3 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/dynamic_shape_view.py @@ -0,0 +1,17 @@ +# mypy: allow-untyped-defs +import torch + +class DynamicShapeView(torch.nn.Module): + """ + Dynamic shapes should be propagated to view arguments instead of being + baked into the exported graph. + """ + + def forward(self, x): + new_x_shape = x.size()[:-1] + (2, 5) + x = x.view(*new_x_shape) + return x.permute(0, 2, 1) + +example_args = (torch.randn(10, 10),) +tags = {"torch.dynamic-shape"} +model = DynamicShapeView() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/fn_with_kwargs.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/fn_with_kwargs.py new file mode 100644 index 0000000000000000000000000000000000000000..46b2637b398c21bf9399d0a3fa2a964354beea3e --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/fn_with_kwargs.py @@ -0,0 +1,30 @@ +# mypy: allow-untyped-defs +import torch + +class FnWithKwargs(torch.nn.Module): + """ + Keyword arguments are not supported at the moment. + """ + + def forward(self, pos0, tuple0, *myargs, mykw0, **mykwargs): + out = pos0 + for arg in tuple0: + out = out * arg + for arg in myargs: + out = out * arg + out = out * mykw0 + out = out * mykwargs["input0"] * mykwargs["input1"] + return out + +example_args = ( + torch.randn(4), + (torch.randn(4), torch.randn(4)), + *[torch.randn(4), torch.randn(4)] +) +example_kwargs = { + "mykw0": torch.randn(4), + "input0": torch.randn(4), + "input1": torch.randn(4), +} +tags = {"python.data-structure"} +model = FnWithKwargs() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/list_contains.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/list_contains.py new file mode 100644 index 0000000000000000000000000000000000000000..35a140f4ee2e5d6f42c3509984333db896f1c081 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/list_contains.py @@ -0,0 +1,17 @@ +# mypy: allow-untyped-defs +import torch + +class ListContains(torch.nn.Module): + """ + List containment relation can be checked on a dynamic shape or constants. + """ + + def forward(self, x): + assert x.size(-1) in [6, 2] + assert x.size(0) not in [4, 5, 6] + assert "monkey" not in ["cow", "pig"] + return x + x + +example_args = (torch.randn(3, 2),) +tags = {"torch.dynamic-shape", "python.data-structure", "python.assert"} +model = ListContains() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/nested_function.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/nested_function.py new file mode 100644 index 0000000000000000000000000000000000000000..e4076ac14dada40b4d78812666a9ec6b5e67045b --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/nested_function.py @@ -0,0 +1,23 @@ +# mypy: allow-untyped-defs +import torch + +class NestedFunction(torch.nn.Module): + """ + Nested functions are traced through. Side effects on global captures + are not supported though. + """ + + def forward(self, a, b): + x = a + b + z = a - b + + def closure(y): + nonlocal x + x += 1 + return x * y + z + + return closure(x) + +example_args = (torch.randn(3, 2), torch.randn(2)) +tags = {"python.closure"} +model = NestedFunction() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/null_context_manager.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/null_context_manager.py new file mode 100644 index 0000000000000000000000000000000000000000..80d09f68097edbe676077be183711dabe5cbc664 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/null_context_manager.py @@ -0,0 +1,21 @@ +# mypy: allow-untyped-defs +import contextlib + +import torch + +class NullContextManager(torch.nn.Module): + """ + Null context manager in Python will be traced out. + """ + + def forward(self, x): + """ + Null context manager in Python will be traced out. + """ + ctx = contextlib.nullcontext() + with ctx: + return x.sin() + x.cos() + +example_args = (torch.randn(3, 2),) +tags = {"python.context-manager"} +model = NullContextManager() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/optional_input.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/optional_input.py new file mode 100644 index 0000000000000000000000000000000000000000..9693aa476f0eb31ec912c840ed3a4426ac832de8 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/optional_input.py @@ -0,0 +1,20 @@ +# mypy: allow-untyped-defs +import torch +from torch._export.db.case import SupportLevel + + +class OptionalInput(torch.nn.Module): + """ + Tracing through optional input is not supported yet + """ + + def forward(self, x, y=torch.randn(2, 3)): + if y is not None: + return x + y + return x + + +example_args = (torch.randn(2, 3),) +tags = {"python.object-model"} +support_level = SupportLevel.NOT_SUPPORTED_YET +model = OptionalInput() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/pytree_flatten.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/pytree_flatten.py new file mode 100644 index 0000000000000000000000000000000000000000..804e73c5a6d58ad5b5be179bf67a5d5bc38c2e2b --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/pytree_flatten.py @@ -0,0 +1,16 @@ +# mypy: allow-untyped-defs +import torch + +from torch.utils import _pytree as pytree + +class PytreeFlatten(torch.nn.Module): + """ + Pytree from PyTorch can be captured by TorchDynamo. + """ + + def forward(self, x): + y, _spec = pytree.tree_flatten(x) + return y[0] + 1 + +example_args = ({1: torch.randn(3, 2), 2: torch.randn(3, 2)},), +model = PytreeFlatten() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/scalar_output.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/scalar_output.py new file mode 100644 index 0000000000000000000000000000000000000000..86d3b4645330c47c3625736b695d635f4ab58c70 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/scalar_output.py @@ -0,0 +1,23 @@ +# mypy: allow-untyped-defs +import torch + +from torch.export import Dim + +x = torch.randn(3, 2) +dim1_x = Dim("dim1_x") + +class ScalarOutput(torch.nn.Module): + """ + Returning scalar values from the graph is supported, in addition to Tensor + outputs. Symbolic shapes are captured and rank is specialized. + """ + def __init__(self) -> None: + super().__init__() + + def forward(self, x): + return x.shape[1] + 1 + +example_args = (x,) +tags = {"torch.dynamic-shape"} +dynamic_shapes = {"x": {1: dim1_x}} +model = ScalarOutput() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/specialized_attribute.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/specialized_attribute.py new file mode 100644 index 0000000000000000000000000000000000000000..f17092f9afc681b91a982a8a2479ac1dde4f455d --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/specialized_attribute.py @@ -0,0 +1,26 @@ +# mypy: allow-untyped-defs +from enum import Enum + +import torch + +class Animal(Enum): + COW = "moo" + +class SpecializedAttribute(torch.nn.Module): + """ + Model attributes are specialized. + """ + + def __init__(self) -> None: + super().__init__() + self.a = "moo" + self.b = 4 + + def forward(self, x): + if self.a == Animal.COW.value: + return x * x + self.b + else: + raise ValueError("bad") + +example_args = (torch.randn(3, 2),) +model = SpecializedAttribute() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_for_loop.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_for_loop.py new file mode 100644 index 0000000000000000000000000000000000000000..aa62b86d16d9b6a1c539976a891f58bd732ae30d --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_for_loop.py @@ -0,0 +1,16 @@ +# mypy: allow-untyped-defs +import torch + +class StaticForLoop(torch.nn.Module): + """ + A for loop with constant number of iterations should be unrolled in the exported graph. + """ + + def forward(self, x): + # constant + ret = [i + x for i in range(10)] + return ret + +example_args = (torch.randn(3, 2),) +tags = {"python.control-flow"} +model = StaticForLoop() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_if.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_if.py new file mode 100644 index 0000000000000000000000000000000000000000..f169380159a45489142ce5ae3523b2e4504c6721 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/static_if.py @@ -0,0 +1,18 @@ +# mypy: allow-untyped-defs +import torch + +class StaticIf(torch.nn.Module): + """ + `if` statement with static predicate value should be traced through with the + taken branch. + """ + + def forward(self, x): + if len(x.shape) == 3: + return x + torch.ones(1, 1, 1) + + return x + +example_args = (torch.randn(3, 2, 2),) +tags = {"python.control-flow"} +model = StaticIf() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/tensor_setattr.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/tensor_setattr.py new file mode 100644 index 0000000000000000000000000000000000000000..8fbc263e7ff2240a3cf8618c56f152e744aa40e8 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/tensor_setattr.py @@ -0,0 +1,15 @@ +# mypy: allow-untyped-defs +import torch + + +class TensorSetattr(torch.nn.Module): + """ + setattr() call onto tensors is not supported. + """ + def forward(self, x, attr): + setattr(x, attr, torch.randn(3, 2)) + return x + 4 + +example_args = (torch.randn(3, 2), "attr") +tags = {"python.builtin"} +model = TensorSetattr() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/type_reflection_method.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/type_reflection_method.py new file mode 100644 index 0000000000000000000000000000000000000000..99ad42a153c512d65aaae1bcac2377ee1e124f25 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/type_reflection_method.py @@ -0,0 +1,22 @@ +# mypy: allow-untyped-defs +import torch + +class A: + @classmethod + def func(cls, x): + return 1 + x + +class TypeReflectionMethod(torch.nn.Module): + """ + type() calls on custom objects followed by attribute accesses are not allowed + due to its overly dynamic nature. + """ + + def forward(self, x): + a = A() + return type(a).func(x) + + +example_args = (torch.randn(3, 4),) +tags = {"python.builtin"} +model = TypeReflectionMethod() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/unsupported_operator.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/unsupported_operator.py new file mode 100644 index 0000000000000000000000000000000000000000..f5a52d80b895b3b2c2d85b878ca4efea511e73ea --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/unsupported_operator.py @@ -0,0 +1,18 @@ +# mypy: allow-untyped-defs +import torch +from torch._export.db.case import SupportLevel + + +class TorchSymMin(torch.nn.Module): + """ + torch.sym_min operator is not supported in export. + """ + + def forward(self, x): + return x.sum() + torch.sym_min(x.size(0), 100) + + +example_args = (torch.randn(3, 2),) +tags = {"torch.operator"} +support_level = SupportLevel.NOT_SUPPORTED_YET +model = TorchSymMin() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/user_input_mutation.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/user_input_mutation.py new file mode 100644 index 0000000000000000000000000000000000000000..3156b3a1bf2ec6f6361395de3dacb098ecf20c3a --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/db/examples/user_input_mutation.py @@ -0,0 +1,17 @@ +# mypy: allow-untyped-defs +import torch + + +class UserInputMutation(torch.nn.Module): + """ + Directly mutate user input in forward + """ + + def forward(self, x): + x.mul_(2) + return x.cos() + + +example_args = (torch.randn(3, 2),) +tags = {"torch.mutation"} +model = UserInputMutation() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/__init__.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0d8a32748a45afc26692891df77805cc2eb31ed8 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/__init__.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/node_metadata.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/node_metadata.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cefd09466532dc2c8c274dc3294bbe7f6282885b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/node_metadata.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/proxy_value.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/proxy_value.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ba37e84fb6fef67f634c51fdde915ba430011ce4 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/pass_infra/__pycache__/proxy_value.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/__init__.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..afb4fdb3331778c1b223a65c4ad5c93719a1fb17 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/__init__.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/_node_metadata_hook.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/_node_metadata_hook.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e421b5a2271403f26e4a0383c480cbc3f1abfcc0 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/_node_metadata_hook.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/add_runtime_assertions_for_constraints_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/add_runtime_assertions_for_constraints_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a6afdd57ea600197313b042cd4964a53cd631fd5 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/add_runtime_assertions_for_constraints_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/collect_tracepoints_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/collect_tracepoints_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c110dd42d3faba4c7b68f14dab3154b4192756dd Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/collect_tracepoints_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/constant_folding.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/constant_folding.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ca1778bf1e178d0635199f4cc9f69630dff344ba Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/constant_folding.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/functionalize_side_effectful_ops_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/functionalize_side_effectful_ops_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..017cfe0cd7e94239871b69e576d5487273647a56 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/functionalize_side_effectful_ops_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/insert_custom_op_guards.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/insert_custom_op_guards.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f29b504c1eafc67e65fb7d447eb4d3c1e1155f41 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/insert_custom_op_guards.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/lift_constants_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/lift_constants_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39d91f3bd8f5c47ec6c98c64f20ec32cf81e457b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/lift_constants_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/remove_runtime_assertions.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/remove_runtime_assertions.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39fe96b4107ac0051eec5f484f8e13ec03eb0fe1 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/remove_runtime_assertions.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_autocast_with_hop_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_autocast_with_hop_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..004e0958aad09ce78ab0912286ae264f816f5752 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_autocast_with_hop_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_quantized_ops_with_standard_ops_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_quantized_ops_with_standard_ops_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fca846e83b6cccced72175fc2c4e6eda7fcf811c Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_quantized_ops_with_standard_ops_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_set_grad_with_hop_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_set_grad_with_hop_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..339c688efa3544872be3f9fcdd3251e484f3d086 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_set_grad_with_hop_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_view_ops_with_view_copy_ops_pass.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_view_ops_with_view_copy_ops_pass.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e17842939be1c0132b1f8365dcce75beb3646bf3 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_view_ops_with_view_copy_ops_pass.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_with_hop_pass_util.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_with_hop_pass_util.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..555bdead4a9cee58fa87b336accd8fdb96ca3931 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/passes/__pycache__/replace_with_hop_pass_util.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/__init__.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..952e6a03b48e2e8bc7133e7710db14dbc74a39c2 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/__init__.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/dynamic_shapes.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/dynamic_shapes.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..50be53f788977788618a62be85b30350452f7435 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/dynamic_shapes.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4d27241a704a5364d55145f325b2094ab199ba6e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema_check.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema_check.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..655e7fd64478e1e5bc4e13769aae1236fc8b10ef Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/schema_check.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/serialize.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/serialize.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6dff094e594f44ec0fbccd6c4c63b17f57fb875e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/serialize.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/union.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/union.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d6a51e5136b7a20d1b49f05027edeac6f6771d9e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/_export/serde/__pycache__/union.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/__init__.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c01cbd457374c27e40b07daca5ae1644a701767d --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/__init__.py @@ -0,0 +1,15 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" + +from torch.ao.quantization.fx.convert import convert +from torch.ao.quantization.fx.fuse import fuse + +# omitting files that's unlikely to be used right now, for example +# the newly added lower_to_fbgemm etc. +from torch.ao.quantization.fx.prepare import prepare diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/_equalize.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/_equalize.py new file mode 100644 index 0000000000000000000000000000000000000000..7acea4f84a2a0a82f134b6790e573f8f1cb677f2 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/_equalize.py @@ -0,0 +1,38 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx._equalize import ( + _convert_equalization_ref, + _InputEqualizationObserver, + _WeightEqualizationObserver, + calculate_equalization_scale, + clear_weight_quant_obs_node, + convert_eq_obs, + CUSTOM_MODULE_SUPP_LIST, + custom_module_supports_equalization, + default_equalization_qconfig, + EqualizationQConfig, + fused_module_supports_equalization, + get_equalization_qconfig_dict, + get_layer_sqnr_dict, + get_op_node_and_weight_eq_obs, + input_equalization_observer, + is_equalization_observer, + maybe_get_next_equalization_scale, + maybe_get_next_input_eq_obs, + maybe_get_weight_eq_obs_node, + nn_module_supports_equalization, + node_supports_equalization, + remove_node, + reshape_scale, + scale_input_observer, + scale_weight_functional, + scale_weight_node, + update_obs_for_equalization, + weight_equalization_observer, +) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/convert.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..9d6ac350602bb7a97c773a3a09fec0780483379f --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/convert.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.convert import convert diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/fusion_patterns.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/fusion_patterns.py new file mode 100644 index 0000000000000000000000000000000000000000..e29337b3f861e5b54dc9f37d39d12ad975ad1315 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/fusion_patterns.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.fuse_handler import DefaultFuseHandler, FuseHandler diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/graph_module.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/graph_module.py new file mode 100644 index 0000000000000000000000000000000000000000..a71e980a57ba141bdc5bbe9b283d69582eb8fd82 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/graph_module.py @@ -0,0 +1,17 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.graph_module import ( + _is_observed_module, + _is_observed_standalone_module, + FusedGraphModule, + GraphModule, + ObservedGraphModule, + ObservedStandaloneGraphModule, + QuantizedGraphModule, +) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/match_utils.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/match_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..8b49f7c645d8d1bc3a154d62a1295a90b155f986 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/match_utils.py @@ -0,0 +1,14 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.match_utils import ( + _find_matches, + _is_match, + _MatchResult, + MatchAllNode, +) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/prepare.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/prepare.py new file mode 100644 index 0000000000000000000000000000000000000000..ca65dcc04dd0021f0065892ca86e209a1c218473 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/prepare.py @@ -0,0 +1,9 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.prepare import prepare diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/utils.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ef35559884b7c430f1d5c72b21f72979108469a5 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/torch/quantization/fx/utils.py @@ -0,0 +1,20 @@ +# flake8: noqa: F401 +r""" +This file is in the process of migration to `torch/ao/quantization`, and +is kept here for compatibility while the migration process is ongoing. +If you are adding a new entry/functionality, please, add it to the +appropriate files under `torch/ao/quantization/fx/`, while adding an import statement +here. +""" +from torch.ao.quantization.fx.utils import ( + all_node_args_have_no_tensors, + assert_and_get_unique_device, + create_getattr_from_value, + get_custom_module_class_keys, + get_linear_prepack_op_for_dtype, + get_new_attr_name_with_prefix, + get_non_observable_arg_indexes_and_types, + get_qconv_prepack_op, + graph_module_from_producer_nodes, + maybe_get_next_module, +)