-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
Thanks for your contribution! |
@@ -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")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要在前面判断,没有该属性的话返回false
There was a problem hiding this comment.
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]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
start、end的负数,超大值需要覆盖
There was a problem hiding this comment.
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"])): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
静态shape下是支持的负数的,只需要排除动态shape下不支持的情况
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slice FP16的精度误差应该不会这么大,由于误差绝对值跟绝对值相关,可以使用相对误差。使用allclose的rtol参数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Bug fixes
PR changes
OPs
Describe
improve slice op converter