-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[Prim][PIR] Forward decomposite the lerp op #65967
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
补充动态shape的单侧 |
| if (s != l) { | ||
| if (l == 1) { | ||
| shapes[j] = s; | ||
| } else if (s != 1) { | ||
| } else if (s == 1 || s == -1) { | ||
| shapes[j] = l; | ||
| }else if(l == -1){ | ||
| shapes[j] = s; | ||
| } else { |
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.
s表示短的dim
l表示长的dim
这里主要讨论从else if开始的情况,在else if一共有9种情况
- s = -1, l = -1, 不存在 (217行的if确定s和l不相等)
- s = -1, l = 1, 不存在(218行的if确定l不为1)
- s = -1, l > 1, shape[j] = l (l大于1,那么s必然为1,这时候可以确定该维度为大于1的结果l,否则运行时也会报错)
- s = 1, l = -1, shape[j] = l (s为1,但是l是-1,l的可以不是1,所以这里设置为-1)
- s = 1, l = 1, 不存在 (217行的if确定s和l不相等)
- s = 1, l > 1, shape[j] = l (s为1,l大于1,所以直接设置成大于1的)
- s > 1, l = -1, shape[j] = s (s大于1,l为-1,所以l必然为1,不然无法广播,运行时会报错)
- s > 1, l = 1, 不存在 (218行的if确定l不为1)
- s > 1, l > 1, 走断言 (已经确定s和l不相等了,并且都是大于1的数,无法广播)
第一个else if 对应情况3,4,6
第二个else if对应情况7
else对应情况9
| } | ||
| } | ||
| DDim out_dims = common::make_ddim(shapes_out); | ||
| out->set_dims(out_dims); |
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.
todo: 封装成公共函数
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 : #66172
* forward decomposite the lerp op * lerp * fix the bug in the get_output_dims * polish * fix code style * move the modify to infermeta * fix the bug * fix the bug
PR Category
Operator Mechanism
PR Types
New features
Description
前向拆解lerp op