#4846·TensorRT

在 GPU GTX 1660 SUPER 和 A10G 上运行动态 If → Transpose → Resize 时, TensorRT 11.1 和 11.2 产生错误的输出失败

作者: lsj574创建于 2026年9月6日更新于 2026年9月6日
标签Module:Accuracy

def model(batch: int, mode: str, transpose: bool = True, before: bool = False) -> onnx.ModelProto: vi = h.make_tensor_value_info branch_shape = [batch, 1, "W", "H"] if transpose and before else [batch, 1, "H", "W"] branch_input = "ORIENTED" if transpose and before else "X" yes = h.make_graph([h.make_node("Add", [branch_input, "TWO"], ["YES"])], "then", [], [vi("YES", 1, branch_shape)]) no = h.make_graph([h.make_node("Add", [branch_input, "ONE"], ["NO"])], "else", [], [vi("NO", 1, branch_shape)]) nodes = [h.make_node("If", ["COND"], ["SELECTED"], then_branch=yes, else_branch=no)] if transpose and before: nodes.insert(0, h.make_node("Transpose", ["X"], ["ORIENTED"], perm=[0, 1, 3, 2])) if transpose and not before: nodes.append(h.make_node("Transpose", ["SELECTED"], ["ORIENTED"], perm=[0, 1, 3, 2])) nodes.extend( [h.make_node("Cast", ["SIZE"], ["SIZE64"], to=7), h.make_node("Concat", ["NC", "SIZE64"], ["TARGET"], axis=0), h.make_node( "Resize", ["ORIENTED"], ["Y"], mode=mode, align_corners=True, cubic_coeff=-0.75), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0), h.make_node("Cast", ["TARGET"], ["Y"], to=1), h.make_node("Cast", ["Y"], ["Y64"], to=7), h.make_node("Concat", ["NC", "Y64"], ["TARGET"], axis=0),

内容来源: NVIDIA/TensorRT