onnx / onnx

Open standard for machine learning interoperability
https://onnx.ai/
Apache License 2.0
17.97k stars 3.67k forks source link

assert h == 1, "the height of conv must be 1" #2936

Closed NazarovAV closed 4 years ago

NazarovAV commented 4 years ago

Hi! I'm tring to convert GRCNN to tensorrt, but get error:

When I converting grcnn to onnx I get warning, but grcnn.onnx is created:

 from GRCNN import GRCNN
 model = GRCNN(23)
 x = torch.ones(1,1,32,100).float().cuda()
 model = GRCNN(23).eval().cuda()
 torch.onnx.export(model, x, "grcnn.onnx", input_names=['input'], output_names=['output'], export_params=True)

/home/nvidia/zmq_service_for_detectlp/grcnn/GRCNN.py:93: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! assert h == 1, "the height of conv must be 1" /home/nvidia/.local/lib/python3.6/site-packages/torch/onnx/symbolic_opset9.py:1436: UserWarning: Exporting a model to ONNX with a batch_size other than 1, with a variable lenght with LSTM can cause an error when running the ONNX model with a different batch size. Make sure to save the model with a batch size of 1, or define the initial states (h0/c0) as inputs of the model. "or define the initial states (h0/c0) as inputs of the model. ")

then, when I try convert onnx to tensorrt I get an error:

with open('grcnn.onnx', 'rb') as f:
    parser.parse(f.read())

False

engine = builder.build_cuda_engine(network)

[TensorRT] ERROR: Network must have at least one output

skottmckay commented 4 years ago

I'd suggest filing an issue for TensorRT. https://github.com/NVIDIA/TensorRT/issues

The onnx model looks ok, has an output defined, and I was able to run it using onnxruntime with dummy input.