Paddle TRT 运行stnet失败

aemubtdh  于 2021-12-07  发布在  Java
关注(0)|答案(3)|浏览(286)

 1)PaddlePaddle版本:1.5
   2)CPU:i7
   3)GPU:RTX2070
   4)系统环境:ubuntu 16.04

使用官网提供的paddle trt的c++预测代码,能够顺利运行。下载地址

使用paddle c++预测自己训练的stnet模型,若不用trt也能顺利运行,但是一旦开启trt加速之后,就会报错。可能是输入的shape超过4维的原因,请问有什么解决办法?

报错内容:
I1120 14:09:05.386106 12849 tensorrt_subgraph_pass.cc:270] Prepare TRT engine (Optimize model structure, Select OP kernel etc). This process may cost a lot of time.
terminate called after throwing an instance of 'paddle::platform::EnforceNotMet'
what(): Enforce failed. Expected shape.size() <= 4UL, but received shape.size():5 > 4UL:4.
TensorRT' tensor input requires at most 4 dimensions at [/Paddle/paddle/fluid/inference/tensorrt/convert/op_converter.h:54]

输入的维度是这样:
int batch_size=1;
int segnum = 7;
int channels = 15; //3*5
int height = 224;
int width=224;
input_t->Reshape({batch_size, segnum, channels, height, width});

sauutmhj

sauutmhj1#

你好,目前paddle-trt不支持5个channel的输入。请问你的模型的结构__model__ 给个下载链接么,我看一下模型的结构。

2w3rbyxf

2w3rbyxf2#

HI, 感谢回复! 您可以参考下官方stnet模型和预训练参数的下载

我也上传了一份在我的github里,请下载

6za6bjd0

6za6bjd03#

op conv2d_fusion does not have kernel for data_type[float]:data_layout[NCHW]:place[CUDAPlace(0)]:library_type[PLAIN]

相关问题