当前位置:网站首页>Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding

Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding

2022-07-05 08:43:00 Mr.Q

problem :pth turn onnx Set dynamic dimension Dynamic dimensions, As shown below

torch.onnx.export(model, input_tensor, output_onnx,
    opset_version=12,
    do_constant_folding=True,
    input_names=["input"],
    output_names=["output"],
    dynamic_axes={"input": {0: "batch", 2: "height", 3: "width"},
                  "output": {0: "batch", 2: "height", 3: "width"}},
    verbose=False)

however ,onnx turn trt when , The inference dimension must be specified , Otherwise it will be reported warning:

[W] Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding shape to: 1x3x1x1

The input dimension becomes 1x3x1x1, Obviously not .

terms of settlement

Dimension needs to be specified :

 

trtexec.exe --onnx=E:\code\python\TensorRT-main\quickstart\SemanticSegmentation\fcn-resnet101.onnx --minShapes=input:1x3x1026x1282 --optShapes=input:1x3x1026x1282 --maxShapes=input:4x3x1026x1282 --workspace=4096 --saveEngine=E:\code\python\TensorRT-main\quickstart\SemanticSegmentation\fcn-resnet101.engine

原网站

版权声明
本文为[Mr.Q]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050839488842.html