Skip to content

[API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix -part#848

Merged
zhwesky2010 merged 16 commits intoPaddlePaddle:masterfrom
wuhaostudio:Aura-patch
Mar 31, 2026
Merged

[API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix -part#848
zhwesky2010 merged 16 commits intoPaddlePaddle:masterfrom
wuhaostudio:Aura-patch

Conversation

@wuhaostudio
Copy link
Copy Markdown
Contributor

@wuhaostudio wuhaostudio commented Mar 6, 2026

PR Docs

New features

PR APIs

paddle.Tensor.retain_grad
paddle.Tensor.sparse_mask

@paddle-bot
Copy link
Copy Markdown

paddle-bot bot commented Mar 6, 2026

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Mar 6, 2026
@wuhaostudio wuhaostudio changed the title Enhance capatibility with the new API [API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix Mar 6, 2026
@wuhaostudio wuhaostudio changed the title [API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix [API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix -part Mar 6, 2026
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Mar 9, 2026
@wuhaostudio
Copy link
Copy Markdown
Contributor Author

/re-run all-failed

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 16, 2026
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 16, 2026
Copy link
Copy Markdown
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

"torch.Tensor.sparse_mask": {
"Matcher": "ChangeAPIMatcher",
"paddle_api": "paddle.sparse.mask_as"
"Matcher": "ChangePrefixMatcher"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个没有对应的单测,你需要补一下单测

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

好的

Copy link
Copy Markdown
Collaborator

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

这个PR不要修改其他的单测,只需要修改你标记的API的单测:

torch.Tensor.retain_grad
torch.Tensor.sparse_mask


obj = APIBase("torchvision.transforms.functional.normalize")
img_obj = ImageAPIBase("torchvision.transforms.functional.normalize")
obj = APIBase("torchvision.transforms.Normalize")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

这个不要改,不要改动其他单测

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

这个不要改,不要改动其他单测
好的

indices = torch.tensor([[0, 1], [1, 2], [3, 0]]) # 提取两个位置
values = torch.tensor([-1, -1])
mask = torch.sparse_coo_tensor(indices, values, dense.size())
result_sparse = dense.sparse_mask(mask)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

使用关键字测一下

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

使用关键字测一下
好的

@@ -1,4 +1,4 @@
# Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2023?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

2023?

笔误


from apibase import APIBase

obj = APIBase("torch.tensor.sparse_mask")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

torch.Tensor.sparse_mask

文件命名为test_Tensor_sparse_mask.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

已改

@zhwesky2010 zhwesky2010 merged commit 5a3a7e9 into PaddlePaddle:master Mar 31, 2026
8 checks passed
Minestar6 pushed a commit to Minestar6/PaConvert that referenced this pull request Mar 31, 2026
…rch.Tensor.sparse_mask with ChangePrefix -part (PaddlePaddle#848)

* Enhance capatibility with the new API

* Add test singleton

* Update test_tensor_sparse_mask.py

* fix

* fix formatting issues

* Restore singleton

修改因Windows系统NTFS不区分大小写造成的问题

* Restore singleton

修复因Windows系统NTFS不区分文件大小写的错误

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* 增加关键字测试

* Rename test_tensor_sparse_mask.py to test_Tensor_sparse_mask.py
zhwesky2010 added a commit that referenced this pull request Apr 10, 2026
* first

* first_1

* [API Compatibility] iinfo/cummax/cummin/diagflat/ldexp/inner/positive/rad2deg/rot90/nanquantile/neg/erf Edit By AI Agent (#858)

* [API Compatibility] iinfo/cummax/cummin/diagflat/ldexp/inner/positive/rad2deg/rot90/nanquantile/neg/erf Edit By AI Agent

* fix Tensor.cuda/requires_grad/ctx.saved_tensors

* fix CI

* add gc collect

* [API Compatibility No.246, 247] align torch.Tensor.retain_grad And torch.Tensor.sparse_mask with ChangePrefix -part (#848)

* Enhance capatibility with the new API

* Add test singleton

* Update test_tensor_sparse_mask.py

* fix

* fix formatting issues

* Restore singleton

修改因Windows系统NTFS不区分大小写造成的问题

* Restore singleton

修复因Windows系统NTFS不区分文件大小写的错误

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* Restore singleton

* 增加关键字测试

* Rename test_tensor_sparse_mask.py to test_Tensor_sparse_mask.py

* first

* first_1

* second

* second

* Fix CI Problem (#862)

fix CI Problem

* first

* first_1

* [API Compatibility] iinfo/cummax/cummin/diagflat/ldexp/inner/positive/rad2deg/rot90/nanquantile/neg/erf Edit By AI Agent (#858)

* [API Compatibility] iinfo/cummax/cummin/diagflat/ldexp/inner/positive/rad2deg/rot90/nanquantile/neg/erf Edit By AI Agent

* fix Tensor.cuda/requires_grad/ctx.saved_tensors

* fix CI

* add gc collect

* third

* third

* third

* fourth

* fourth_1

* fifth

* sixth

* seventh

* sixth

* seventh

* eighth

---------

Co-authored-by: zhwesky2010 <1183042833@qq.com>
Co-authored-by: AuraWu <143194075+wuhaostudio@users.noreply.github.com>
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