Skip to content

Conversation

@zeroRains
Copy link
Contributor

PR Category

Operator Mechanism

PR Types

New features

Description

前向拆解lerp op

@paddle-bot
Copy link

paddle-bot bot commented Jul 11, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Jul 11, 2024
@cyber-pioneer
Copy link
Contributor

补充动态shape的单侧

Comment on lines 217 to 224
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 {
Copy link
Contributor Author

@zeroRains zeroRains Jul 12, 2024

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种情况

  1. s = -1, l = -1, 不存在 (217行的if确定s和l不相等)
  2. s = -1, l = 1, 不存在(218行的if确定l不为1)
  3. s = -1, l > 1, shape[j] = l (l大于1,那么s必然为1,这时候可以确定该维度为大于1的结果l,否则运行时也会报错)
  4. s = 1, l = -1, shape[j] = l (s为1,但是l是-1,l的可以不是1,所以这里设置为-1)
  5. s = 1, l = 1, 不存在 (217行的if确定s和l不相等)
  6. s = 1, l > 1, shape[j] = l (s为1,l大于1,所以直接设置成大于1的)
  7. s > 1, l = -1, shape[j] = s (s大于1,l为-1,所以l必然为1,不然无法广播,运行时会报错)
  8. s > 1, l = 1, 不存在 (218行的if确定l不为1)
  9. 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);
Copy link
Contributor

Choose a reason for hiding this comment

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

todo: 封装成公共函数

Copy link
Contributor Author

@zeroRains zeroRains Jul 16, 2024

Choose a reason for hiding this comment

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

Done : #66172

@cyber-pioneer cyber-pioneer merged commit 15ef3cb into PaddlePaddle:develop Jul 16, 2024
@zeroRains zeroRains deleted the lerp branch July 16, 2024 09:14
lixcli pushed a commit to lixcli/Paddle that referenced this pull request Jul 22, 2024
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants