Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lluo/cherry pick 3260 #3268

Open
wants to merge 3 commits into
base: release/2.5
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
resolve comments
  • Loading branch information
lanluo-nvidia committed Oct 29, 2024
commit e2f6764eb6c16a7d647ecbcd8618c721db946338
20 changes: 10 additions & 10 deletions py/torch_tensorrt/_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@ def convert_method_to_trt_engine(
enabled_precisions if enabled_precisions is not None else {torch.float}
)

if not arg_inputs and not inputs:
raise AssertionError("'arg_inputs' and 'inputs' should not both be None.")

elif arg_inputs and inputs:
raise AssertionError(
"'arg_inputs' and 'inputs' should not be used at the same time."
)
arg_inputs = arg_inputs or inputs

module_type = _parse_module_type(module)
target_ir = _get_target_fe(module_type, ir)
if target_ir == _IRType.ts:
Expand All @@ -354,7 +363,7 @@ def convert_method_to_trt_engine(
ts_mod = torch.jit.script(module)
serialized_engine: bytes = ts_convert_method_to_trt_engine(
ts_mod,
inputs=inputs,
inputs=arg_inputs,
method_name=method_name,
enabled_precisions=enabled_precisions_set,
**kwargs,
Expand All @@ -366,15 +375,6 @@ def convert_method_to_trt_engine(
)
elif target_ir == _IRType.dynamo:
# Prepare torch and torchtrt inputs
if not arg_inputs and not inputs:
raise AssertionError("'arg_inputs' and 'inputs' should not both be None.")

elif arg_inputs and inputs:
raise AssertionError(
"'arg_inputs' and 'inputs' should not be used at the same time."
)
arg_inputs = arg_inputs or inputs

if kwarg_inputs is None:
kwarg_inputs = {}

Expand Down
Loading