Skip to content

[API Compatibility] Add pp.Tensor.mul_, pp.autograd.Function, pp.argwhere #74493

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

LittleHeroZZZX
Copy link
Contributor

@LittleHeroZZZX LittleHeroZZZX commented Aug 8, 2025

PR Category

User Experience

PR Types

New features

Description

新增三个对齐 torch 的API:pp.Tensor.mul_, pp.autograd.Function, pp.argwhere
pp.Tensor.mul_:相较 pp.multiply,支持第二个参数为标量
pp.autograd.Function:为 pp.autograd.Layer 的别名
pp.argwhere: 为 pp.nonzero 的子集,去掉as_tuple 参数。

image

Copy link

paddle-bot bot commented Aug 8, 2025

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

[2, 4, 6]]])

"""
other_tensor = (
Copy link
Contributor

Choose a reason for hiding this comment

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

这个后面会统一开展,即二元函数支持scalar。

目前就写别名就可以

@@ -1180,6 +1241,21 @@ def multiply_(x: Tensor, y: Tensor, name: str | None = None) -> Tensor:
return _C_ops.multiply_(x, y)


@inplace_apis_in_dygraph_only
def mul_(x: Tensor, other: Numeric) -> Tensor:
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants