From 309fe03f4b55ff42cd3e758a56f6b6ed687a363f Mon Sep 17 00:00:00 2001 From: bobrenjc93 Date: Mon, 22 Sep 2025 15:14:38 -0700 Subject: [PATCH] [torchfuzz] remove unneeded try catch (#163557) Pull Request resolved: https://github.com/pytorch/pytorch/pull/163557 Approved by: https://github.com/laithsakka ghstack dependencies: #163547, #163553, #163554, #163555, #163556 --- .../dynamic_shapes/torchfuzz/ops_fuzzer.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tools/experimental/dynamic_shapes/torchfuzz/ops_fuzzer.py b/tools/experimental/dynamic_shapes/torchfuzz/ops_fuzzer.py index 8e5a7abe197f..3c81c24854d1 100644 --- a/tools/experimental/dynamic_shapes/torchfuzz/ops_fuzzer.py +++ b/tools/experimental/dynamic_shapes/torchfuzz/ops_fuzzer.py @@ -246,19 +246,13 @@ def fuzz_op(target_spec: Spec, depth, stack_size) -> tuple[str, list[Spec]]: random.choice(all_ops) if all_ops else ("arg", get_operator("arg")) ) - # Use the operator to decompose the target spec into input specs - try: - if chosen_operator is None: - # If no operator found, fallback to arg - return _get_arg_args_specs(target_spec) - - input_specs = chosen_operator.fuzz_inputs_specs(target_spec) - return chosen_op_name, input_specs - except Exception as e: - # Fallback to arg if decomposition fails - print(f"Warning: operator {chosen_op_name} decomposition failed: {e}") + if chosen_operator is None: + # If no operator found, fallback to arg return _get_arg_args_specs(target_spec) + input_specs = chosen_operator.fuzz_inputs_specs(target_spec) + return chosen_op_name, input_specs + # Global counter for generating unique argument IDs _next_arg_id = 0