pytorch/test
Richard Zou 2932b0bf37 Extend impl_backward to be usable with torch.library operators (#106817)
- impl_save_for_backward/impl_backward only work for functional,
non-view schemas. We validate this.
- impl_save_for_backward/impl_backward raise if there already exists an
autograd implementation from torch.library / TORCH_LIBRARY.
- Operators constructed via custom_op receive an "autograd indirection
kernel". The "autograd indirection kernel" automatically pulls the
constructed autograd kernel out of a dict. When
impl_save_for_backward/impl_backward get used with torch.library
operators, we also register the "autograd indirection kernel" so we can
reuse the logic.

Test Plan:
- new tests
Pull Request resolved: https://github.com/pytorch/pytorch/pull/106817
Approved by: https://github.com/soulitzer
ghstack dependencies: #106799, #106800
2023-08-14 14:33:46 +00:00
..
_nvfuser Remove dynamo+nvfuser (#105789) 2023-08-08 22:29:32 +00:00
ao/sparsity add pruning method: Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration (#95689) 2023-08-02 16:24:42 +00:00
autograd Don't run test/autograd/test_fallback.py in parallel (#106866) 2023-08-10 00:26:23 +00:00
backends/xeon
benchmark_utils [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
bottleneck_test
cpp [AOTInductor] Remove call to aot_autograd when receiving ExportedProgram (#105977) 2023-08-04 15:35:23 +00:00
cpp_api_parity [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
cpp_extensions Fix CPUFallback Mechinasm on TensorList Type (#105209) 2023-08-05 15:38:30 +00:00
custom_backend [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
custom_operator [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
distributed [device_mesh] move remaining collectives to a separate file (#107012) 2023-08-11 23:49:27 +00:00
distributions NumPy support in torch.compile (#106211) 2023-08-11 00:39:32 +00:00
dynamo Run translation validation on tracing error. (#106645) 2023-08-14 13:43:34 +00:00
edge [torchgen] Rename executorch's RuntimeContext to KernelRuntimeContext (#104892) 2023-07-14 21:15:50 +00:00
error_messages [BE] Enable ruff's UP rules and autoformat dynamo / functorch and refs (#105432) 2023-07-19 13:48:44 +00:00
expect Revert "Add _foreach_clamp (#106574)" 2023-08-11 21:05:04 +00:00
export Keep fx node name consistent with aot_export (#107068) 2023-08-12 23:12:03 +00:00
forward_backward_compatibility Revert "[export] Refactor constrain_as_value and constrain_as_size (#106591)" 2023-08-11 16:37:47 +00:00
functorch Implement decomposition for aten.rrelu_with_noise (#106812) 2023-08-11 19:18:29 +00:00
fx Change _dynamo.export to be export(f)(*args, **kwargs) (#106109) 2023-07-27 21:41:13 +00:00
inductor [inductor] Optimize away zero-element loads (#107074) 2023-08-12 07:58:14 +00:00
jit torch.jit.script escape hatch (#106229) 2023-08-11 18:24:46 +00:00
jit_hooks
lazy Use yaml.SafeLoader instead of legacy yaml.Loader (#100443) 2023-05-02 18:32:36 +00:00
mobile [BE] Enable ruff's UP rules in pyproject.toml (#105437) 2023-07-21 19:14:52 +00:00
nn [test_nn] add custom device support for dropout tests、lazy_modules te… (#106609) 2023-08-11 09:14:34 +00:00
onnx [ONNX] Migrate to PT2 logging (#106592) 2023-08-11 23:27:00 +00:00
onnx_caffe2 [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
optim [forward-fix] Fix multigpu varying tensor optim tests (#106887) 2023-08-10 16:35:38 +00:00
package [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
profiler [pytorch profiler] fix profiler test for windows (#106156) 2023-07-28 00:53:09 +00:00
quantization [pytorch][ao] Add torch.matmul in FloatFunctional/QFunctional (#106831) 2023-08-10 22:43:36 +00:00
scripts
test_img
torch_np NumPy support in torch.compile (#106211) 2023-08-11 00:39:32 +00:00
typing
_test_bazel.py [bazel] add build for functorch (#101475) 2023-05-18 20:29:08 +00:00
allowlist_for_publicAPI.json Add _foreach_sign (#106343) 2023-08-01 22:33:34 +00:00
conftest.py Do not collect and skip non-disabled tests when rerunning disabled tests (#102107) 2023-05-27 12:10:36 +00:00
create_dummy_torchscript_model.py
delete.py
HowToWriteTestsUsingFileCheck.md
linear.py
load_torchscript_model.py
mkl_verbose.py
mkldnn_verbose.py
run_doctests.sh
run_test.py Revert "Reordering tests experiment (#106347)" 2023-08-11 23:59:48 +00:00
simulate_nccl_errors.py
test_ao_sparsity.py add pruning method: Filter Pruning via Geometric Median for Deep Convolutional Neural Networks Acceleration (#95689) 2023-08-02 16:24:42 +00:00
test_autocast.py [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
test_autograd.py Don't run test/autograd/test_fallback.py in parallel (#106866) 2023-08-10 00:26:23 +00:00
test_autograd_fallback.py Don't run test/autograd/test_fallback.py in parallel (#106866) 2023-08-10 00:26:23 +00:00
test_binary_ufuncs.py add lerp cpu support for half (#105607) 2023-07-21 20:29:05 +00:00
test_bundled_images.py
test_bundled_inputs.py
test_comparison_utils.py
test_compile_benchmark_util.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_complex.py
test_content_store.py Add load_storage (#100519) 2023-05-05 05:25:03 +00:00
test_cpp_api_parity.py
test_cpp_extensions_aot.py Use random inputs for mps extension tests (#104597) 2023-07-06 07:14:56 +00:00
test_cpp_extensions_jit.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_cpp_extensions_open_device_registration.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_cuda.py [NAdam] Add capturable API and tests + fix differentiable (#106615) 2023-08-07 19:49:11 +00:00
test_cuda_expandable_segments.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_cuda_multigpu.py Revert "Fix test failure in TestCudaMultiGPU.test_cuda_device_memory_allocated (#105501)" 2023-07-24 14:18:44 +00:00
test_cuda_nvml_based_avail.py
test_cuda_primary_ctx.py [BE] Use TEST_MULTIGPU from common_cuda.py (#103982) 2023-06-22 00:07:44 +00:00
test_cuda_sanitizer.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_cuda_trace.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_custom_ops.py Extend impl_backward to be usable with torch.library operators (#106817) 2023-08-14 14:33:46 +00:00
test_dataloader.py unify TEST_CUDA (#106685) 2023-08-10 09:01:36 +00:00
test_datapipe.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_decomp.py Implement decomposition for aten.rrelu_with_noise (#106812) 2023-08-11 19:18:29 +00:00
test_deploy.py
test_determination.py
test_dispatch.py [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
test_dlpack.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_dynamic_shapes.py Handle Rational divisors in FloorDiv. (#106644) 2023-08-07 16:52:22 +00:00
test_expanded_weights.py tf32 context fixes for various tests (#103137) 2023-06-15 02:33:12 +00:00
test_fake_tensor.py Test fixes (#106586) 2023-08-04 23:23:17 +00:00
test_flop_counter.py De-register forward hooks upon exiting flop counter context (#103744) 2023-06-20 19:34:02 +00:00
test_foreach.py Revert "Add _foreach_clamp (#106574)" 2023-08-11 21:05:04 +00:00
test_function_schema.py
test_functional_autograd_benchmark.py
test_functional_optim.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_functionalization.py Upgrade LoggingTensor mode and add traceback collection (#103734) 2023-06-21 22:04:30 +00:00
test_functionalization_of_rng_ops.py
test_futures.py [Reland] Update mypy to 1.4.1 (#105227) 2023-07-15 20:30:20 +00:00
test_fx.py Back out "Reland "Make adding buffers more like adding parameters (#104069)" (#106224)" (#106743) 2023-08-08 15:27:34 +00:00
test_fx_experimental.py Run translation validation on tracing error. (#106645) 2023-08-14 13:43:34 +00:00
test_fx_passes.py Introduce aggressive merge to CapabilityPartitioner (#100195) 2023-05-05 23:20:17 +00:00
test_fx_reinplace_pass.py
test_hub.py [BE]: Apply ruff PERF fixes to torch (#104917) 2023-07-11 20:45:21 +00:00
test_import_stats.py
test_indexing.py [Fix Bug] Cannot assign index like x[[1,2], :] = 2 when torch.use_deterministic_algorithms(True) to main (#105833) 2023-08-07 17:00:19 +00:00
test_itt.py
test_jit.py Revert "Remove set_default_dtype from nn tests (#105775)" 2023-08-11 22:14:17 +00:00
test_jit_autocast.py
test_jit_cuda_fuser.py Remove set_default_dtype calls from jit and ops tests (#105072) 2023-07-15 03:18:33 +00:00
test_jit_disabled.py
test_jit_fuser.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_jit_fuser_legacy.py
test_jit_fuser_te.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_jit_legacy.py
test_jit_llga_fuser.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_jit_profiling.py
test_jit_simple.py
test_jit_string.py
test_jiterator.py
test_kernel_launch_checks.py
test_legacy_vmap.py [BE]: Apply ruff PERF fixes to torch (#104917) 2023-07-11 20:45:21 +00:00
test_license.py
test_linalg.py Reenable torch._int_mm testing on newer CUDAs (#106840) 2023-08-09 16:23:30 +00:00
test_logging.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_masked.py
test_maskedtensor.py Tighten FakeTensor reentrancy asserts, add debugging (#102091) 2023-05-24 05:37:51 +00:00
test_matmul_cuda.py [ROCm] Enable a few bfloat16 unit tests (#105177) 2023-08-03 21:17:19 +00:00
test_meta.py Implement decomposition for aten.rrelu_with_noise (#106812) 2023-08-11 19:18:29 +00:00
test_metal.py
test_mkl_verbose.py
test_mkldnn.py [BE]: Apply ruff PERF fixes to torch (#104917) 2023-07-11 20:45:21 +00:00
test_mkldnn_fusion.py [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
test_mkldnn_verbose.py
test_mobile_optimizer.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_model_dump.py
test_module_init.py Reland "Add nn.CircularPad{*}d for consistency + fix no_batch_dim support (#106148)" (#106632) 2023-08-07 20:10:25 +00:00
test_modules.py Add error inputs to ModuleInfo (mirroring OpInfo) (#106325) 2023-08-01 12:49:56 +00:00
test_monitor.py
test_mps.py Back out "Reland "Make adding buffers more like adding parameters (#104069)" (#106224)" (#106743) 2023-08-08 15:27:34 +00:00
test_multiprocessing.py
test_multiprocessing_spawn.py
test_namedtensor.py [BE] f-stringify torch/ and scripts (#105538) 2023-07-21 19:35:24 +00:00
test_namedtuple_return_api.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_native_functions.py [Dynamo] Fix nested function resume execution (#100426) 2023-05-11 03:10:23 +00:00
test_native_mha.py
test_nestedtensor.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_nn.py Revert "Remove set_default_dtype from nn tests (#105775)" 2023-08-11 22:14:17 +00:00
test_nnapi.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_numba_integration.py
test_numpy_interop.py
test_nvfuser_frontend.py
test_openmp.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_ops.py Remove dynamo+nvfuser (#105789) 2023-08-08 22:29:32 +00:00
test_ops_fwd_gradients.py
test_ops_gradients.py [custom_op] explicit autograd API (#101824) 2023-05-23 18:31:29 +00:00
test_ops_jit.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_optim.py [optim][BE] split test file into logical parts: SWA, LR, optim (#101100) 2023-05-12 16:41:44 +00:00
test_out_dtype_op.py [quant][pt2e][fix] Remove the requirement of using no_grad for reference model that contains quantized conv2d (#106924) 2023-08-10 19:16:10 +00:00
test_overrides.py let torch.device be overrideable by TorchFunctionMode (#106514) 2023-08-04 10:47:43 +00:00
test_package.py
test_per_overload_api.py
test_prims.py Remove dynamo+nvfuser (#105789) 2023-08-08 22:29:32 +00:00
test_proxy_tensor.py [pt2] add Python metas for special ops (#106683) 2023-08-13 14:12:21 +00:00
test_pruning_op.py NumPy support in torch.compile (#106211) 2023-08-11 00:39:32 +00:00
test_public_bindings.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_python_dispatch.py Enable registering fallthroughs to (op, dk) from torch.library (#106086) 2023-07-28 19:37:59 +00:00
test_pytree.py Serialize empty pytree cases (#105159) 2023-07-13 23:02:59 +00:00
test_quantization.py add basic cuda support for float8 dtypes (#105807) 2023-07-25 03:43:36 +00:00
test_reductions.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_scatter_gather_ops.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_schema_check.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_segment_reductions.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_serialization.py [BE]: Update Ruff to 0.0.280 (#105724) 2023-07-22 23:03:34 +00:00
test_set_default_mobile_cpu_allocator.py
test_shape_ops.py
test_show_pickle.py
test_sort_and_select.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_sparse.py sparse.mm.backward: fix for non-contiguous grad values on CPU (#106127) 2023-07-28 01:25:00 +00:00
test_sparse_csr.py [ROCm] Enable a few bfloat16 unit tests (#105177) 2023-08-03 21:17:19 +00:00
test_sparse_semi_structured.py Revert "[core][pruning][feature] cuSPARSELt kernels and ops (#102133)" 2023-08-09 16:03:14 +00:00
test_spectral_ops.py
test_stateless.py Back out "Reland "Make adding buffers more like adding parameters (#104069)" (#106224)" (#106743) 2023-08-08 15:27:34 +00:00
test_static_runtime.py
test_subclass.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_sympy_utils.py Replace sympy.solve with a new simplified one. (#105877) 2023-08-02 17:53:29 +00:00
test_tensor_creation_ops.py [fbcode] Use FastCat in PT Concat implementation (#106727) 2023-08-13 22:36:51 +00:00
test_tensorboard.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_tensorexpr.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_tensorexpr_pybind.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_testing.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_throughput_benchmark.py
test_torch.py [inductor] fix test_dim_function_empty (#106994) 2023-08-11 21:38:53 +00:00
test_transformers.py test_fused_sdp_choice in test_transformers.py fix (#106587) 2023-08-04 03:43:56 +00:00
test_type_hints.py
test_type_info.py
test_type_promotion.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_typing.py
test_unary_ufuncs.py Support complex inputs in nan_to_num (#106944) 2023-08-11 09:15:57 +00:00
test_utils.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00
test_view_ops.py
test_vulkan.py
test_weak.py
test_xnnpack_integration.py [BE] Enable ruff's UP rules and autoformat test/ (#105434) 2023-07-19 20:36:06 +00:00