Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[inference]add Slice op converter test #35100

Merged
merged 2 commits into from
Sep 15, 2021
Merged

Conversation

xingjing1
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

improve slice op converter

@CLAassistant
Copy link

CLAassistant commented Aug 23, 2021

CLA assistant check
All committers have signed the CLA.

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@xingjing1 xingjing1 changed the title Slice op [inference]add Slice op converter test Aug 25, 2021
Shixiaowei02
Shixiaowei02 previously approved these changes Aug 25, 2021
@@ -521,9 +521,16 @@ bool OpTeller::Tell(const framework::ir::Node* node, bool use_no_calib_int8,
BOOST_GET_CONST(std::vector<int>, desc.GetAttr("starts"));
std::vector<int> ends =
BOOST_GET_CONST(std::vector<int>, desc.GetAttr("ends"));
std::vector<int> decrease_axis =
BOOST_GET_CONST(std::vector<int>, desc.GetAttr("decrease_axis"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要在前面判断,没有该属性的话返回false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

"op_attrs": {
"axes": [[1, 3]],
"starts": [[0, 1]],
"ends": [[1, 2]],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start、end的负数,超大值需要覆盖

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的已修改

if start >= end:
return False
## ends or starts less than zero or larger than input size will segement fault so we omit it
for x in range(len(attrs[0]["axes"])):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

静态shape下是支持的负数的,只需要排除动态shape下不支持的情况

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的已修改

yield self.create_inference_config(), generate_trt_nodes_num(
attrs, False), 1e-5
self.trt_param.precision = paddle_infer.PrecisionType.Half
yield self.create_inference_config(), generate_trt_nodes_num(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slice FP16的精度误差应该不会这么大,由于误差绝对值跟绝对值相关,可以使用相对误差。使用allclose的rtol参数

Copy link
Contributor

@cryoco cryoco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cryoco cryoco merged commit 09a4896 into PaddlePaddle:develop Sep 15, 2021
AnnaTrainingG pushed a commit to AnnaTrainingG/Paddle that referenced this pull request Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants