From 7a94f8b3aad86ef513eed9556ab873a441a3e44f Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Wed, 10 Sep 2025 09:16:54 -0700 Subject: [PATCH 1/2] fix guard_fn issue --- tests/py/dynamo/conversion/harness.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/py/dynamo/conversion/harness.py b/tests/py/dynamo/conversion/harness.py index 93ffc8b451..bfcb6d3a0b 100644 --- a/tests/py/dynamo/conversion/harness.py +++ b/tests/py/dynamo/conversion/harness.py @@ -434,7 +434,11 @@ def run_test( propagate_shapes=propagate_shapes, settings=compilation_settings, ) + from torch_tensorrt.dynamo.lowering.passes.remove_num_users_is_0_nodes import ( + remove_num_users_is_0_nodes, + ) + mod = remove_num_users_is_0_nodes(mod, compilation_settings) num_inputs = len(inputs) trt_inputs = inputs dtype_to_change = [] From efb6b6746ffe1156a04f4a393e17e80efb345256 Mon Sep 17 00:00:00 2001 From: lanluo-nvidia Date: Wed, 10 Sep 2025 12:46:32 -0700 Subject: [PATCH 2/2] resolve comments --- tests/py/dynamo/conversion/harness.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/py/dynamo/conversion/harness.py b/tests/py/dynamo/conversion/harness.py index bfcb6d3a0b..646f034a79 100644 --- a/tests/py/dynamo/conversion/harness.py +++ b/tests/py/dynamo/conversion/harness.py @@ -26,11 +26,17 @@ post_lowering, pre_export_lowering, ) +from torch_tensorrt.dynamo.lowering.passes import remove_num_users_is_0_nodes from torch_tensorrt.dynamo.runtime import PythonTorchTensorRTModule from torch_tensorrt.dynamo.utils import ATOL, RTOL, get_model_device, get_torch_inputs _LOGGER: logging.Logger = logging.getLogger(__name__) +# this is the post lowering pass list for the converter test +post_lowering_pass_list_for_converter_test = [ + remove_num_users_is_0_nodes, +] + # this method is only used in our converter test to infer the module output dtypes via dummy inference # which is due to fx.symbolic_trace does not have the meta['val'] info in the node @@ -434,11 +440,9 @@ def run_test( propagate_shapes=propagate_shapes, settings=compilation_settings, ) - from torch_tensorrt.dynamo.lowering.passes.remove_num_users_is_0_nodes import ( - remove_num_users_is_0_nodes, - ) - mod = remove_num_users_is_0_nodes(mod, compilation_settings) + for pass_func in post_lowering_pass_list_for_converter_test: + mod = pass_func(mod, compilation_settings) num_inputs = len(inputs) trt_inputs = inputs dtype_to_change = []