You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐛 [Bug] Engine build fails when an all-zero F.pad is followed by an elementwise op (seen in SmolVLA) #4988
Padding by zero on every side changes nothing, but Torch-TensorRT still builds a padding layer for it. The constant pad converter always builds a slice layer in fill mode, with its start and shape given as tensors built inside the network. With TensorRT 11.4, when an elementwise op follows that layer, the engine build fails with an internal assertion. (A zero pad with nothing after it was not tested.)
Real models hit this. SmolVLA's resize_with_pad resizes the image and then pads it by the leftover amount. For a square 256x256 camera image, the leftover is zero on every side, so the vision encoder fails to build. In current LeRobot, a 512x512 image builds fine, because the helper returns before the pad.
RuntimeError: TensorRT could not build the engine: [graphOptimizer.cpp::fusePattern::2092] Error Code 2: Internal Error (Assertion std::ranges::all_of( first.inputs, [&](NodeTensor const& t) { return t.get() == first.inputs[0].get(); }) failed. In fusePattern at /_src/optimizer/common/rewrite/graphOptimizer.cpp:2092)
Expected behavior
The engine builds and matches PyTorch. A small fix: when every pad amount is a constant zero, the converter (or a lowering pass) returns the input unchanged.
Until then, a workaround is to skip the F.pad call when all the amounts are zero, or to feed images that are already the target size.
Environment
Torch-TensorRT Version: 2.16.0.dev, built from main
Activity
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): skip the constant pad layer when every pad amount is…
fix(conversion): leave out a constant pad when every pad amount is zero
fix(conversion): leave out a constant pad when every pad amount is zero
fix(conversion): leave out a constant pad when every pad amount is zero
fix(conversion): leave out a constant pad when every pad amount is zero
fix(conversion): leave out a constant pad when every pad amount is zero
fix(conversion): leave out a constant pad when every pad amount is zero