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

fix cumsum bug (#54160)

上级 cfadd6b6
......@@ -51,7 +51,7 @@ class CumsumOpConverter : public OpConverter {
return Add1DConstantLayer(d, "", scalar);
} else {
nvinfer1::ITensor* inpShape = Shape(inpTensor);
return GetEleTensorOfShape(inpShape, d, scalar);
return GetEleTensorOfShape(inpShape, axis, scalar);
}
};
......
......@@ -529,6 +529,12 @@ class OpConverter {
nvinfer1::ITensor* GetEleTensorOfShape(nvinfer1::ITensor* shape_tensor,
int index,
bool is_scalar = false) {
PADDLE_ENFORCE_GE(
index,
0,
platform::errors::PreconditionNotMet(
"The index should be greater or equal than 0, but got %d", index));
auto* tensor =
TRT_ENGINE_ADD_LAYER(engine_,
Gather,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册