pytorch/test/jit
ekamiti 9e473fd868 Make adding Buffers more like adding Parameters (#125971)
Add similar semantics for creating a buffer object similar to creating a parameter. This is done by introducing a new Buffer class that can be used for type disambiguation. The underlying functionality of registering a buffer remains the same as the register_buffer method has not been changed. The persistent parameter in the Buffer type is to indicate whether a buffer object should be persistent or not. Other non-test changes have to do with getting the new Buffer type recognized by inductor and dynamo. Remaining changes are test changes to make sure that the Buffer type can be used as a drop in replacement for register_buffer as it just leads to register_buffer being called. The addition of this new functionality still allows for normal tensors to be used as buffers so these changes are intended to be backwards compatible.

Fixes #35735

Co-authored-by: Mikayla Gawarecki <mikaylagawarecki@gmail.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/125971
Approved by: https://github.com/albanD, https://github.com/anijain2305, https://github.com/mlazos
2024-07-31 10:32:40 +00:00
..
_imported_class_test Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
fixtures
fixtures_srcs Revert "[BE][Easy] use pathlib.Path instead of dirname / ".." / pardir (#129374)" 2024-06-29 00:47:15 +00:00
xnnpack Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
__init__.py
mydecorator.py [torch] Use __prepare_scriptable__ for closures (#121553) 2024-03-11 19:14:19 +00:00
myexception.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
myfunction_a.py [torch] Use __prepare_scriptable__ for closures (#121553) 2024-03-11 19:14:19 +00:00
myfunction_b.py [torch] Use __prepare_scriptable__ for closures (#121553) 2024-03-11 19:14:19 +00:00
test_alias_analysis.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_async.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_aten_pow.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_attr.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_autodiff.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_autodiff_subgraph_slicing.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_await.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_backend_nnapi.py Revert "[BE][Easy] use pathlib.Path instead of dirname / ".." / pardir (#129374)" 2024-06-29 00:47:15 +00:00
test_backends.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_batch_mm.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_builtins.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_class_type.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_complex.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_complexity.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_convert_activation.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_cuda.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_custom_operators.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_data_parallel.py [BE][Easy] fix ruff rule needless-bool (SIM103) (#130206) 2024-07-14 08:17:52 +00:00
test_dataclasses.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_dce.py
test_decorator.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_device_analysis.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_dtype_analysis.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_enum.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_exception.py [BE]: TRY002 - Ban raising vanilla exceptions (#124570) 2024-04-21 22:26:40 +00:00
test_freezing.py [BE] enable ruff rule RSE and remove useless parentheses in raise statements (#124261) 2024-04-17 19:29:34 +00:00
test_functional_blocks.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_fuser_common.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_generator.py
test_graph_rewrite_passes.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_hash.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_hooks.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_hooks_modules.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_ignorable_args.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_ignore_context_manager.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_isinstance.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_jit_utils.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_list_dict.py [BE]: Update flake8-comprehensions and enable C420 (#130699) 2024-07-16 13:47:49 +00:00
test_logging.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_misc.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_models.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_module_apis.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_module_containers.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_module_interface.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_modules.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_op_decompositions.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_optimize_for_mobile_preserve_debug_info.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_parametrization.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_pdt.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_peephole.py [BE]: TRY002 - Ban raising vanilla exceptions (#124570) 2024-04-21 22:26:40 +00:00
test_profiler.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_python_bindings.py
test_python_builtins.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_python_ir.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_recursive_script.py [1/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort stdlib (#127122) 2024-05-25 08:25:50 +00:00
test_remove_mutation.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_save_load.py Make adding Buffers more like adding Parameters (#125971) 2024-07-31 10:32:40 +00:00
test_save_load_for_op_version.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_script_profile.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_scriptmod_ann.py [TorchScript] Expand TorchScript __init__ annotation warning (#127045) 2024-05-28 23:49:10 +00:00
test_slice.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_sparse.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_string_formatting.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_symbolic_shape_analysis.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_tensor_creation_ops.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_tensor_methods.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_torchbind.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_tracer.py [BE]: Enable a few additional ruff rules (#130700) 2024-07-17 02:06:04 +00:00
test_type_sharing.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_types.py [5/N][Easy] fix typo for usort config in pyproject.toml (kown -> known): sort torch (#127126) 2024-05-27 14:49:57 +00:00
test_typing.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_union.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_union_pep604.py
test_unsupported_ops.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_upgraders.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_warn.py Enable UFMT on all of test/jit (#123623) 2024-04-11 23:45:05 +00:00
test_with.py [BE]: TRY002 - Ban raising vanilla exceptions (#124570) 2024-04-21 22:26:40 +00:00