Skip to content
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

[Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test #61793

Merged
merged 4 commits into from
Feb 20, 2024

Conversation

flying-forever
Copy link
Contributor

@flying-forever flying-forever commented Feb 18, 2024

Copy link

paddle-bot bot commented Feb 18, 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 Feb 18, 2024
Copy link

paddle-bot bot commented Feb 18, 2024

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@SigureMo
Copy link
Member

SigureMo commented Feb 18, 2024

需要按照模板重新填写下 PR 描述,另外 PR 描述里应该包含 tracking issue,PR 标题应该符合 tracking issue 里的模式,都需要调整下,可参考其它 PR

dg.to_variable上面通常都放在with dg.guard(...):语句下面,我不太确定它是否也需要处理

当前不需要处理

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

以及

@@ -31,8 +31,8 @@ def compare(self):
b = np.array([[1.0 + 1.0j, 1.0 + 1.0j]]).astype(self._dtype)

with dg.guard():
x = dg.to_variable(a, "x")
y = dg.to_variable(b)
x = paddle.to_tensor(a, "x")
Copy link
Member

Choose a reason for hiding this comment

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

两者签名分别如下

def to_variable(value, name=None, zero_copy=None, dtype=None): ...
def to_tensor(data, dtype=None, place=None, stop_gradient=True): ...

这里将原来的 name 传递到 dtype 了,name 参数在这里无用,删掉吧

x = dg.to_variable(a, "x")
y = dg.to_variable(b)
x = paddle.to_tensor(a, "x")
y = paddle.to_tensor(b)
out = paddle.add(x, y)
self.assertIsNotNone(f"{out}")
Copy link
Member

Choose a reason for hiding this comment

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

这个 assert 删掉吧,没啥用,f"{out}" 永远不可能为 None

var_x = dg.to_variable(x)
var_y = dg.to_variable(y)
var_x = paddle.to_tensor(x)
var_y = paddle.to_tensor(x)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var_y = paddle.to_tensor(x)
var_y = paddle.to_tensor(y)

@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Feb 19, 2024
@flying-forever flying-forever changed the title 残党 B:paddle.base.dygraph.to_variable [Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test Feb 20, 2024
@flying-forever flying-forever changed the title [Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test [Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test Feb 20, 2024
@flying-forever flying-forever changed the title [Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test [Cleanup][B-4] clean some paddle.base.dygraph.to_variable for test Feb 20, 2024
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow

@SigureMo SigureMo merged commit a4d6b5d into PaddlePaddle:develop Feb 20, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants