未验证 提交 0bf40070 编写于 作者: Z zhoutianzi666 提交者: GitHub

enforce_reshape (#45386)

上级 4e3f0b95
...@@ -70,6 +70,16 @@ class ReshapeOpConverter : public OpConverter { ...@@ -70,6 +70,16 @@ class ReshapeOpConverter : public OpConverter {
layer->setReshapeDimensions(reshape_dim); layer->setReshapeDimensions(reshape_dim);
else else
layer->setInput(1, *real_shape_tensor); layer->setInput(1, *real_shape_tensor);
PADDLE_ENFORCE_GE(
layer->getOutput(0)->getDimensions().nbDims,
0,
platform::errors::InvalidArgument(
"Errors occures in Paddle-TRT reshape2 op, try to use C++ Api "
"config.Exp_DisableTensorRtOPs({\"reshape2\"})\n; or Python Api "
"config.exp_disable_tensorrt_ops([\"reshape2\"]) to forbid "
"reshape2 op into "
"Paddle-TRT."));
auto output_name = op_desc.Output("Out")[0]; auto output_name = op_desc.Output("Out")[0];
RreplenishLayerAndOutput(layer, "reshape", {output_name}, test_mode); RreplenishLayerAndOutput(layer, "reshape", {output_name}, test_mode);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册