How to make this model exported convertable to trt engine?

I know this not related about pytorch but possible about pytorch symblic to onnx, I have this model and I converted to onnx, but somehow the model can not converted to tensorrt using onnx2trt:

class MG(nn.Module):

    def __init__(self):
        super().__init__()
        # for test if torch.cat([bool, bool]) can convert

    def forward(self, x, b):
        preds = F.conv2d(x, b,
                             stride=1)
        return preds


torch_model = MG()
x = torch.randn([1, 4, 24, 24])
b = torch.randn([8, 4, 3, 3])
torch_out = torch_model(x, b)

# Export the model
torch.onnx.export(torch_model,               # model being run
                  (x, b),
                  "a.onnx",
                  export_params=True,        # store the trained parameter weights inside the model file
                  opset_version=11,          # the ONNX version to export the model to
                  do_constant_folding=True,
                  verbose=True)
print('Done!')

It’s very simple model. I want accerlerate it with tensorrt, but using onnx2trt convert onnx, I got error:

  [8] Assertion failed: ctx->network()->hasExplicitPrecision() && "TensorRT only supports multi-input conv for explicit precision QAT networks!"

A reference is [8] Assertion failed: ctx->network()->hasExplicitPrecision() && "TensorRT only supports multi-input conv for explicit precision QAT networks!" · Issue #645 · onnx/onnx-tensorrt · GitHub

I found the onnx-tensorrt is no one maintain it but I really need it, so ask to pytorch community doesn anyone able to solve it?

BTW: this model seems can converted in pytorch 1.6 but can not converted to pytorch 1.7.

1 Like

Does anyone help me out?

@ptoews Can u help me?