-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Add trt pow converter. #53462
Add trt pow converter. #53462
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
for shape in [ | ||
[32], | ||
[batch, 32], | ||
[batch, 32, 32], | ||
[batch, 32, 16, 32], | ||
]: |
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为[]
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.
done
VLOG(3) << "Convert a pow op to TensorRT IElementWiseLayer"; | ||
framework::OpDesc op_desc(op, nullptr); | ||
auto* X = engine_->GetITensor(op_desc.Input("X").front()); | ||
float factor = PADDLE_GET_CONST(float, op_desc.GetAttr("factor")); |
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.
根据pow op的定义,factor attr应该有其他数据类型(float|int|Tensor),这里或者op_teller里是不是应该做过滤?
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.
pow op factor存到模型中只可能是float,如果是tensor,则会成为elementwise_pow
// The diff between pow
and elementwise_pow
is in:
// https://github.com/PaddlePaddle/Paddle/blob/release/2.4/python/paddle/tensor/math.py#L420
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.
int呢?
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.
int的话,模型中会存储成float
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
* Add trt pow converter. * update to use AddConstantLayer * add dims=0 ut
…rRT (#53752) * scale, square, sum, swish trt op converter support zero dim (#53660) * [Paddle-Inference] Support trt 0dims of expand_as_v2 and mish. (#53627) * support_expand_mish * add unitest for reshpe 0 dims (#53685) * Add trt pow converter. (#53462) * Add trt pow converter. * update to use AddConstantLayer * add dims=0 ut * [inference Zero-Dim]add equal, elementwise_op trt 0d (#53704) * [inference Zero-Dim]prelu trt converter support zero dim tensor (#53634) * prelu op trt converter support zero dim * [Inference Zero-Dim] Support trt 0dim of gelu, hard_swish, hard_sigmoid and leaky_relu (#53714) * support_act * delete_silu * [inference zero dim] softmax, stack op trt converter support zero dim (#53729) * softmax support * support stack * remove unused code * update --------- Co-authored-by: Yuanle Liu <yuanlehome@163.com> Co-authored-by: xiaoxiaohehe001 <49090790+xiaoxiaohehe001@users.noreply.github.com> Co-authored-by: zhoutianzi666 <39978853+zhoutianzi666@users.noreply.github.com> Co-authored-by: Wilber <jiweibo@baidu.com>
PR types
Others
PR changes
Others
Description
增加pow的trt converter映射。