Open liu-mengyang opened 2 years ago
Environment
Reproduction Steps
CASE
unit.py: Generate ONNX graph with a Pad layer with reflect mode.
unit.py
Pad
reflect
import torch import torch.nn as nn import torch.nn.functional as F class ReflectPad(nn.Module): def __init__(self): super(ReflectPad, self).__init__() def forward(self, input): out = F.pad(input, (0, 1, 0, 2), "reflect") return out input = torch.arange(9, dtype=torch.float).reshape(1, 1, 3, 3).cuda() print(input) rp = ReflectPad().cuda() out = rp(input) print(out) torch.onnx.export(rp, input, "unit.onnx", input_names=["input"], output_names=["output"], verbose=True, keep_initializers_as_inputs=True, opset_version=13, dynamic_axes={"input": {0: "batch_size"}})
parse.sh: parse the onnx graph generated
parse.sh
#!/usr/bin/env bash python3 unit.py trtexec \ --onnx=unit.onnx \ --explicitBatch \ --minShapes=lr:1x3x64x64 \ --optShapes=lr:1x3x80x80 \ --maxShapes=lr:1x3x120x120 \ --saveEngine=unit.plan \ --workspace=40960 \ --buildOnly \ --noTF32 \ --verbose \
Run this case:
bash parse.sh
Expected Behavior
Actual Behavior
[06/27/2022-11:15:47] [E] [TRT] ModelImporter.cpp:776: --- End node --- [06/27/2022-11:15:47] [E] [TRT] ModelImporter.cpp:779: ERROR: ModelImporter.cpp:180 In function parseGraph: [6] Invalid Node - Pad_13 [shuffleNode.cpp::symbolicExecute::392] Error Code 4: Internal Error (Reshape_3: IShuffleLayer applied to shape tensor must have 0 or 1 reshape dimensions: dimensions were [-1,2]) [06/27/2022-11:15:47] [E] Failed to parse onnx file [06/27/2022-11:15:47] [I] Finish parsing network model [06/27/2022-11:15:47] [E] Parsing model failed [06/27/2022-11:15:47] [E] Failed to create engine from model or file. [06/27/2022-11:15:47] [E] Engine set up failed &&&& FAILED TensorRT.trtexec [TensorRT v8401] # trtexec --onnx=unit.onnx --explicitBatch --minShapes=lr:1x3x64x64 --optShapes=lr:1x3x80x80 --maxShapes=lr:1x3x120x120 --saveEngine=unit.plan --workspace=40960 --buildOnly --noTF32 --verbose
Additional Notes
Hello,the given link is invalid,could you provide other link. Thanks
Environment
Reproduction Steps
CASE
unit.py
: Generate ONNX graph with aPad
layer withreflect
mode.parse.sh
: parse the onnx graph generatedRun this case:
Expected Behavior
Pad
layer in ONNX, especially ND padding, along withreflect
padding mode.Actual Behavior
Additional Notes