Skip to content

Conversation

@xiaoguoguo626807
Copy link
Contributor

@xiaoguoguo626807 xiaoguoguo626807 commented Dec 25, 2023

PR types

others

PR changes

others

Description

pcard-67164

  1. 原静态图while 反向对以下样例求梯度有误
    while i < 11
    {x = i * i,
    i = i +1}
    out = mean(x)
    grad(out,(x,i))
    1> 求梯度 i_grad的计算将每一次循环的结果进行累加,但i 作为循环变量(循环体有读有写),梯度是每轮进行更新,而不是累加。
    2> 每轮计算x_grad 都使用mean_grad产生的结果,但除最后一次循环产生的x与mean有关,之前的循环中,x 未被使用,x_grad都应该为0。

删除原始静态图测试,改为新ir测试。

@paddle-bot
Copy link

paddle-bot bot commented Dec 25, 2023

你的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.

Copy link
Contributor

@changeyoung98 changeyoung98 left a comment

Choose a reason for hiding this comment

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

LGTM

@xiaoguoguo626807 xiaoguoguo626807 merged commit d1344c9 into PaddlePaddle:develop Dec 27, 2023
@xiaoguoguo626807 xiaoguoguo626807 deleted the while_4 branch December 27, 2023 10:43
Wanglongzhi2001 pushed a commit to Wanglongzhi2001/Paddle that referenced this pull request Jan 7, 2024
…0328)

* optimize backward

* modfiy while_loop

* delete print

* modify append_full_like use copy value

* clear

* clear
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.

2 participants