Open
Conversation
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:50:57.564183+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:51:30.211201+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)
torch.manual_seed(0)
# %%
+
# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attention53a9dfc to
f42a040
Compare
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:52:54.555414+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:53:26.945609+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)
torch.manual_seed(0)
# %%
+
# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attentionf42a040 to
42d89f8
Compare
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:54:57.305479+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/compile_with_dynamic_inputs.py 2026-01-29 19:55:29.533323+00:00
@@ -24,10 +24,11 @@
logging.basicConfig(level=logging.DEBUG)
torch.manual_seed(0)
# %%
+
# Define a model with expand and reshape operations
# This is a simplified Vision Transformer pattern with:
# - A learnable class token that needs to expand to match batch size
# - A QKV projection followed by reshaping for multi-head attention42d89f8 to
8977704
Compare
There was a problem hiding this comment.
There are some changes that do not conform to Python style guidelines:
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/autocast_example.py 2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/autocast_example.py 2026-01-29 19:58:29.240203+00:00
@@ -104,21 +104,19 @@
should_be_fp16 = [
autocast_outs[8],
]
should_be_bf16 = [autocast_outs[3], autocast_outs[4], autocast_outs[6]]
-assert all(a.dtype == torch.float32 for a in should_be_fp32), (
- "Some Autocast outputs are not float32!"
-)
-assert all(a.dtype == torch.float16 for a in should_be_fp16), (
- "Some Autocast outputs are not float16!"
-)
-assert all(a.dtype == torch.bfloat16 for a in should_be_bf16), (
- "Some Autocast outputs are not bfloat16!"
-)
+assert all(
+ a.dtype == torch.float32 for a in should_be_fp32
+), "Some Autocast outputs are not float32!"
+assert all(
+ a.dtype == torch.float16 for a in should_be_fp16
+), "Some Autocast outputs are not float16!"
+assert all(
+ a.dtype == torch.bfloat16 for a in should_be_bf16
+), "Some Autocast outputs are not bfloat16!"
for i, (a, w) in enumerate(zip(autocast_outs, pytorch_outs)):
assert torch.allclose(
a.to(torch.float32), w.to(torch.float32), atol=1e-2, rtol=1e-2
- ), (
- f"Autocast and Pytorch outputs do not match! autocast_outs[{i}] = {a}, pytorch_outs[{i}] = {w}"
- )
+ ), f"Autocast and Pytorch outputs do not match! autocast_outs[{i}] = {a}, pytorch_outs[{i}] = {w}"
print("All dtypes and values match!")
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/refit_engine_example.py 2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/refit_engine_example.py 2026-01-29 19:58:29.373306+00:00
@@ -103,13 +103,13 @@
expected_outputs, refitted_outputs = (
exp_program2.module()(*inputs),
new_trt_gm(*inputs),
)
for expected_output, refitted_output in zip(expected_outputs, refitted_outputs):
- assert torch.allclose(expected_output, refitted_output, 1e-2, 1e-2), (
- "Refit Result is not correct. Refit failed"
- )
+ assert torch.allclose(
+ expected_output, refitted_output, 1e-2, 1e-2
+ ), "Refit Result is not correct. Refit failed"
print("Refit successfully!")
# %%
#
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/nvrtc_aot_plugin.py 2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/nvrtc_aot_plugin.py 2026-01-29 19:58:29.417137+00:00
@@ -237,10 +237,10 @@
print("Running inference with compiled model...")
with torch.no_grad():
for i in range(10):
res = model_trt(input)
- assert torch.allclose(res, model(input), rtol=1e-2, atol=1e-2), (
- "Results do not match!"
- )
+ assert torch.allclose(
+ res, model(input), rtol=1e-2, atol=1e-2
+ ), "Results do not match!"
print("Inference successful!")
--- /home/runner/work/TensorRT/TensorRT/examples/dynamo/mutable_torchtrt_module_example.py 2026-01-29 19:57:56.468654+00:00
+++ /home/runner/work/TensorRT/TensorRT/examples/dynamo/mutable_torchtrt_module_example.py 2026-01-29 19:58:29.464922+00:00
@@ -55,13 +55,13 @@
# Check the output
# The refit happens while you call the mutable module again.
with torch.no_grad():
expected_outputs, refitted_outputs = model2(*inputs), mutable_module(*inputs)
for expected_output, refitted_output in zip(expected_outputs, refitted_outputs):
- assert torch.allclose(expected_output, refitted_output, 1e-2, 1e-2), (
- "Refit Result is not correct. Refit failed"
- )
+ assert torch.allclose(
+ expected_output, refitted_output, 1e-2, 1e-2
+ ), "Refit Result is not correct. Refit failed"
print("Refit successfully!")
# %%
# Saving Mutable Torch TensorRT Module8977704 to
a1fa190
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix documentation building
Fixes # (issue)
Type of change
Please delete options that are not relevant and/or add your own.
Checklist: