pytorch/test
Malay Bag 058782c6ab [torch.export] Rmoving unused constants - add support for corner case (#165205)
Summary: In some cases unused constant had only one level of child node, no second level of child node. Those constants should be removed too. The added test case has the scenario where this scenario will happen.

Test Plan:
```
buck test mode/opt caffe2/test:test_export -- 'test_unused_constant'
```

https://www.internalfb.com/intern/testinfra/testrun/15481123837456594

Differential Revision: D84398413

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165205
Approved by: https://github.com/angelayi
2025-10-14 20:26:28 +00:00
..
ao/sparsity Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
autograd
backends/xeon
benchmark_utils [BE][3/6] fix typos in test/ (#157637) 2025-07-17 12:08:33 +00:00
compiled_autograd_skips
cpp Revert "C++ API handle optimizer defaults (#161825)" 2025-10-10 17:56:11 +00:00
cpp_api_parity
cpp_extensions Revert "Enable ruff rule E721 (#165162)" 2025-10-11 13:25:40 +00:00
custom_backend
custom_operator Using the latest torch.library.register_fake API instead of torch.library.impl_abstract (#158839) 2025-07-25 02:37:30 +00:00
distributed [FSDP2] provide public API to share cuda streams across roots (#165024) 2025-10-14 17:50:46 +00:00
distributions Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
dynamo Patch the flex_attention._get_mod_type to not use inspect.signature when computing num_positional_args (an alternative fix for flex attention graph break on create_block_mask) (#164923) 2025-10-14 18:29:15 +00:00
dynamo_expected_failures [dict] Implement __eq__ for dict_items (#155154) 2025-10-14 18:56:51 +00:00
dynamo_skips Add functions to setup PrivateUse1 as a python backend device. (#157859) 2025-10-01 21:32:59 +00:00
error_messages
expect Add _scaled_mm_v2 API (#164141) 2025-10-09 12:43:18 +00:00
export [torch.export] Rmoving unused constants - add support for corner case (#165205) 2025-10-14 20:26:28 +00:00
forward_backward_compatibility Revert "[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml (#164641)" 2025-10-09 15:42:51 +00:00
functorch [annotate] Annotation should be mapped across submod (#165202) 2025-10-14 16:19:38 +00:00
fx Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
higher_order_ops [compile] Regional inductor compilation with fx.annotate (#164776) 2025-10-13 22:22:20 +00:00
inductor [inductor] fix issue for example value with unbacked strides (#163660) 2025-10-14 20:07:51 +00:00
inductor_expected_failures [dynamo] Graph break on on user-defined class in compiled region (#161670) 2025-09-10 04:39:20 +00:00
inductor_skips
jit Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
jit_hooks
lazy Do not decompose in functionalization/proxy tensor if autograd wouldn't have decomposed (#164939) 2025-10-11 01:03:55 +00:00
mobile Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
nn Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
onnx [ONNX] TorchTensor supports tofile() (#165195) 2025-10-13 19:12:06 +00:00
optim [optim] prevent unintended aliasing in lr_scheduler; update type annotations/docs (#163120) 2025-09-25 06:58:58 +00:00
package [Torch Package] Make get names of OrderedImporters support fallback to importers (#155743) 2025-08-06 02:26:10 +00:00
profiler Revert "Fix double dispatch to Python for detach (#163671)" 2025-10-14 03:55:36 +00:00
quantization bf16 support for per_channel bwd (#165325) 2025-10-14 05:47:32 +00:00
scripts [BE][PYFMT] migrate PYFMT for test/[i-z]*/ to ruff format (#144556) 2025-07-29 03:26:09 +00:00
strobelight/examples
test_img
torch_np Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
typing Revert "Add __init__.pyi to torch/linalg (#160750)" 2025-09-02 16:53:55 +00:00
xpu [WOQ] Add XPU kernel for _weight_int8pack_mm (#160938) 2025-09-19 07:37:14 +00:00
_test_bazel.py
allowlist_for_publicAPI.json Revert "[BC-Breaking] Remove long-deprecated casting functions from native_functions.yaml (#164641)" 2025-10-09 15:42:51 +00:00
bench_mps_ops.py [BE] Remove macos-13 guard from bench_mps_ops (#159732) 2025-08-03 20:53:58 +00:00
conftest.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
create_dummy_torchscript_model.py
HowToWriteTestsUsingFileCheck.md
linear.py
load_torchscript_model.py
minioptest_failures_dict.json
mkl_verbose.py
mkldnn_verbose.py
pytest_shard_custom.py
run_doctests.sh
run_test.py [CI] Fix doctest job if build without distributed (#165449) 2025-10-14 19:19:03 +00:00
simulate_nccl_errors.py
slow_tests.json Update slow tests (#165301) 2025-10-13 11:47:32 +00:00
test_accelerator.py Add UT for torch.accelerator memory-related API (#155200) 2025-08-08 17:41:22 +00:00
test_ao_sparsity.py [testing] Add test owner labels for some ao sparse tests (#163203) 2025-09-18 16:08:13 +00:00
test_appending_byte_serializer.py
test_autocast.py Revert "[AMP][Refactor] Simplify dtype support logic in autocast context manager (#163446)" 2025-10-10 15:12:46 +00:00
test_autograd_fallback.py Fix TestAutogradFallback flaky tests under Dynamo: migrate to lib._destroy() (#159443) 2025-07-30 19:30:55 +00:00
test_autograd.py Revert "Fix double dispatch to Python for detach (#163671)" 2025-10-14 03:55:36 +00:00
test_autoload.py
test_binary_ufuncs.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_bundled_images.py
test_bundled_inputs.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_ci_sanity_check_fail.py
test_comparison_utils.py
test_compile_benchmark_util.py
test_complex.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_content_store.py [ROCm] Enabling several UTs (#161715) 2025-09-09 15:49:21 +00:00
test_cpp_api_parity.py Revert "Stop parsing command line arguments every time common_utils is imported. (#156703)" 2025-08-04 20:37:39 +00:00
test_cpp_extensions_aot.py Replace setup.py install with pip install (#156711) 2025-09-29 15:15:10 +00:00
test_cpp_extensions_jit.py [MPSHooks] Release pending command encoder (#164093) 2025-09-29 17:50:12 +00:00
test_cpp_extensions_mtia_backend.py
test_cpp_extensions_stream_and_event.py
test_cuda_expandable_segments.py
test_cuda_multigpu.py [ROCm] Enabling several UTs (#161715) 2025-09-09 15:49:21 +00:00
test_cuda_nvml_based_avail.py More ruff SIM fixes (#164695) 2025-10-09 03:24:50 +00:00
test_cuda_primary_ctx.py [ROCm][CI] skip TestCudaPrimaryCtx.test_set_device_0 (#163693) 2025-09-23 22:15:10 +00:00
test_cuda_sanitizer.py
test_cuda_trace.py
test_cuda.py Revert "Update round size with 1 division behavior (#162203)" 2025-10-13 18:32:37 +00:00
test_custom_ops.py [Bugfix][vLLM] Explicitly do not support instead of crashing for named tuples in infer schema (#165191) 2025-10-14 14:18:42 +00:00
test_dataloader.py Skip test_ind_worker_queue on Windows and macOS (flaky) (#162555) 2025-09-10 07:05:14 +00:00
test_datapipe.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_decomp.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_determination.py
test_dispatch.py
test_dlpack.py [Fix] Completely remove stride normalization on DLPack Tensor (#164161) 2025-10-14 17:17:11 +00:00
test_dynamic_shapes.py do not overguard when comparing lists (#165091) 2025-10-11 20:37:51 +00:00
test_expanded_weights.py Revert "Stop parsing command line arguments every time common_utils is imported. (#156703)" 2025-08-04 20:37:39 +00:00
test_extension_utils.py
test_fake_tensor.py [FakeTensor] Supplement the relevant logic for converting conv1d to conv2d in meta_conv (#160408) 2025-09-26 15:45:02 +00:00
test_file_check.py
test_flop_counter.py [ROCm] Enable MI355 CI on PRs, and run full set of UTs on PRs (#160215) 2025-10-09 18:03:12 +00:00
test_foreach.py Remove old ROCm version check in tests (#164245) 2025-10-06 22:42:01 +00:00
test_function_schema.py
test_functional_autograd_benchmark.py
test_functional_optim.py
test_functionalization_of_rng_ops.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_functionalization.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_futures.py
test_fx_experimental.py [fx] fix split_module with symint (#160093) 2025-08-13 05:50:15 +00:00
test_fx_passes.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_fx_reinplace_pass.py [dynamic shapes] avoid unnecessary slices (#157528) 2025-07-10 06:34:46 +00:00
test_fx.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_hop_infra.py
test_hub.py
test_import_stats.py
test_indexing.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_itt.py
test_jit_autocast.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_jit_disabled.py
test_jit_fuser_legacy.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_fuser_te.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_fuser.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_legacy.py Stop parsing command line arguments every time common_utils is imported. (#156703) 2025-10-02 22:22:04 +00:00
test_jit_llga_fuser.py
test_jit_profiling.py
test_jit_simple.py
test_jit_string.py More ruff SIM fixes (#164695) 2025-10-09 03:24:50 +00:00
test_jit.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_jiterator.py
test_kernel_launch_checks.py [testing] Add test owner labels for some cuda? tests (#163296) 2025-09-26 18:26:56 +00:00
test_legacy_vmap.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_license.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_linalg.py [ROCm][CI] Add support for gfx1100 in rocm workflow + test skips (#148355) 2025-10-07 22:36:25 +00:00
test_logging.py
test_masked.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_maskedtensor.py Fix MaskedTensor to device ignored mask (#151205) 2025-07-21 21:44:49 +00:00
test_matmul_cuda.py [ROCm][CI] Add support for gfx1100 in rocm workflow + test skips (#148355) 2025-10-07 22:36:25 +00:00
test_meta.py [Inductor] support mixed dtype in the native_layer_norm_backward meta function (#159830) 2025-09-17 20:29:12 +00:00
test_metal.py
test_mkl_verbose.py
test_mkldnn_fusion.py
test_mkldnn_verbose.py
test_mkldnn.py Enable TF32 as fp32 internal precision for matmul/linear/conv (#157520) 2025-07-17 08:57:34 +00:00
test_mobile_optimizer.py
test_model_exports_to_core_aten.py Replace export_for_training with export (#162396) 2025-09-10 14:19:34 +00:00
test_module_tracker.py
test_modules.py [ROCm][CI] unskip some test_memory_format tests (#162766) 2025-09-12 15:02:40 +00:00
test_monitor.py
test_mps.py [MPS] Support large tensors in torch.cat (#164416) 2025-10-13 16:56:56 +00:00
test_multiprocessing_spawn.py Test multiprocessing spawn timing fix (#160672) 2025-08-15 00:11:55 +00:00
test_multiprocessing.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_namedtensor.py Fix tensor creation with empty names crash (#163957) 2025-09-26 17:41:00 +00:00
test_namedtuple_return_api.py
test_native_functions.py
test_native_mha.py
test_nestedtensor.py [NJT] Fix schema validation error in jagged functions (#165307) 2025-10-13 17:59:18 +00:00
test_nn.py [cuDNN][RNN] cuDNN RNN supports BFloat16 inputs since 9.13 (#164411) 2025-10-08 15:26:50 +00:00
test_nnapi.py
test_numa_binding.py Revert "[RELAND] Always build USE_DISTRIBUTED (#160449) and Make distributed modules importable even when backend not built (#159889) (#162594)" 2025-09-25 13:47:46 +00:00
test_numba_integration.py [testing] Add test owner labels for some cuda? tests (#163296) 2025-09-26 18:26:56 +00:00
test_numpy_interop.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_opaque_obj_v2.py [opaque_obj_v2] PyObject custom op schema type (#165004) 2025-10-14 20:21:04 +00:00
test_opaque_obj.py [opaque_obj] Add make_fx tracing support (#163278) 2025-10-08 09:09:16 +00:00
test_openmp.py
test_ops_fwd_gradients.py
test_ops_gradients.py
test_ops_jit.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_ops.py [1/N]Enable some tests in test_ops.TestCommon on Intel GPU (#159944) 2025-09-29 09:08:04 +00:00
test_optim.py Fix LBFGS wolfe max iteration (#161488) 2025-09-16 12:07:50 +00:00
test_out_dtype_op.py
test_overrides.py Revert "[Reland] Use std::string_view in torchgen (#158625)" 2025-09-13 07:52:50 +00:00
test_package.py
test_per_overload_api.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_prims.py [Bugfix] Match eager stride semantics for cloned tensors with preserve_format in compile (#163017) 2025-09-19 19:41:33 +00:00
test_privateuseone_python_backend.py Add functions to setup PrivateUse1 as a python backend device. (#157859) 2025-10-01 21:32:59 +00:00
test_proxy_tensor.py Fix refine_ranges corner case (#164075) (#164846) 2025-10-08 18:42:37 +00:00
test_pruning_op.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_public_bindings.py Revert "[CUDA] Add experimental green context support for SM carveout (#159104)" 2025-10-07 20:51:22 +00:00
test_python_dispatch.py Revert "Fix double dispatch to Python for detach (#163671)" 2025-10-14 03:55:36 +00:00
test_pytree.py [BE][pytree] cleanup parameterized pytree tests (#160842) 2025-09-05 20:15:29 +00:00
test_quantization.py Remove pytorch quant docs since we are moving to torchao (#157766) 2025-07-11 03:21:47 +00:00
test_reductions.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_rename_privateuse1_to_existing_device.py [Device] Add support for PrivateUse1 device type in parse_type function (#157609) 2025-07-17 01:27:44 +00:00
test_scaled_matmul_cuda.py [ROCm] hotfix test scaled matmul cuda (#165104) 2025-10-10 21:06:58 +00:00
test_scatter_gather_ops.py fix deterministic scatter_add path for multi-d tensors (#162866) 2025-09-15 06:50:00 +00:00
test_schema_check.py [inductor] slow test some Windows UTs. (#160267) 2025-08-10 18:35:42 +00:00
test_segment_reductions.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_serialization.py Revert "Enable all SIM rules except disabled ones (#164645)" 2025-10-05 19:32:21 +00:00
test_set_default_mobile_cpu_allocator.py
test_shape_ops.py
test_show_pickle.py
test_sort_and_select.py Add dtype checks in meta dispatch for various ordering ops (#159556) 2025-08-14 17:06:27 +00:00
test_sparse_csr.py Remove old ROCm version check in tests (#164245) 2025-10-06 22:42:01 +00:00
test_sparse_semi_structured.py Remove test conditions for CUDA<12 (#163495) 2025-09-23 07:52:00 +00:00
test_sparse.py [MPS] sparse norm (#164961) 2025-10-08 21:41:42 +00:00
test_spectral_ops.py
test_stateless.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_static_runtime.py
test_subclass.py
test_sympy_utils.py [1/N] Apply UP035 rule in tests (#163947) 2025-09-29 01:42:01 +00:00
test_tensor_creation_ops.py Fix channels-last dimension mapping in CUDA parallel_cat (#165023) 2025-10-09 20:04:32 +00:00
test_tensorboard.py Fix protobuf test comparison by parsing proto instead of raw strings (#162644) 2025-09-12 16:26:54 +00:00
test_tensorexpr_pybind.py
test_tensorexpr.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_testing.py [1/N] Apply UP035 rule in tests (#163947) 2025-09-29 01:42:01 +00:00
test_throughput_benchmark.py
test_torch.py error message for instantiating CUDA Stream if CUDA not available (#159868) 2025-10-11 23:21:35 +00:00
test_torchfuzz_repros.py Fix truediv numerics between eager and compile (#164144) 2025-10-10 22:18:11 +00:00
test_transformers.py [cuDNN][SDPA] Handle noncontig nested tensors in cuDNN SDPA (#164958) 2025-10-09 21:58:54 +00:00
test_type_hints.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_type_info.py Pyrefly suppressions 7/n (#164913) 2025-10-08 07:27:17 +00:00
test_type_promotion.py Enable ruff rule E721 (#165162) 2025-10-13 01:48:55 +00:00
test_typing.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_unary_ufuncs.py [BUG] Fix nonzero_static crash on CUDA when the input is a empty tensor (#162578) 2025-09-15 05:44:15 +00:00
test_utils_config_module.py
test_utils_filelock.py
test_utils.py Revert "Add device argument to torch.random.get_rng_state (#163034)" 2025-10-04 15:25:45 +00:00
test_view_ops.py unify broadcast_shapes functions and avoid duplicates (#160251) 2025-08-16 00:54:32 +00:00
test_vulkan.py
test_weak.py [BE][2/6] fix typos in test/ (test/test_*.py) (#157636) 2025-07-09 11:02:23 +00:00
test_xnnpack_integration.py
test_xpu.py Add a new API torch.xpu.is_tf32_supported for Intel GPU (#163141) 2025-10-12 12:11:57 +00:00