Skip to content

[API Compatibility No.114] support torch-style kwarg input for paddle.masked_fill via decorator -part#77801

Merged
zhwesky2010 merged 2 commits intoPaddlePaddle:developfrom
Aidenwu0209:api-compatibility-114
Feb 15, 2026
Merged

[API Compatibility No.114] support torch-style kwarg input for paddle.masked_fill via decorator -part#77801
zhwesky2010 merged 2 commits intoPaddlePaddle:developfrom
Aidenwu0209:api-compatibility-114

Conversation

@Aidenwu0209
Copy link
Contributor

@Aidenwu0209 Aidenwu0209 commented Feb 10, 2026

PR Category

User Experience

PR Types

New features

Description

Add PyTorch-style input keyword argument alias for paddle.masked_fill via @param_one_alias(["x", "input"]) decorator.

After this PR, the following calls are equivalent:

  • paddle.masked_fill(x, mask, value)
  • paddle.masked_fill(x=x, mask=mask, value=value)
  • paddle.masked_fill(input=x, mask=mask, value=value) (PyTorch style)

C++ sink (python_api_info.yaml) is not viable because masked_fill's C++ op requires Tensor value but the Python API accepts scalar; registering via yaml bypasses the scalar-to-Tensor conversion.

Related Issue: #76301 (Task No.114)

是否引起精度变化

@paddle-bot
Copy link

paddle-bot bot commented Feb 10, 2026

你的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 10, 2026
@Aidenwu0209 Aidenwu0209 force-pushed the api-compatibility-114 branch from ccc83c9 to 8e079fd Compare February 10, 2026 02:17
@luotao1 luotao1 added HappyOpenSource 快乐开源活动issue与PR API Compatibility labels Feb 10, 2026
@Aidenwu0209 Aidenwu0209 force-pushed the api-compatibility-114 branch from b620033 to 919b885 Compare February 10, 2026 03:02
@Aidenwu0209 Aidenwu0209 force-pushed the api-compatibility-114 branch from 201d91c to 0a2db70 Compare February 10, 2026 10:12
@Aidenwu0209 Aidenwu0209 changed the title [API Compatibility No.114] support torch-style kwarg input for paddle.masked_fill via python modification -part [API Compatibility No.114] support torch-style kwarg input for paddle.masked_fill via decorator -part Feb 10, 2026
)
paddle.enable_static()

def test_dygraph_duplicate_args(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

这个不用测

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已删除 test_dygraph_duplicate_args 测试方法。



# Test masked_fill compatibility
class TestMaskedFillAPI(unittest.TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

挪到上面去,随机一个位置,不然很容易发生冲突

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已将 TestMaskedFillAPI 挪到 TestSquareAPI 之后(文件中间位置),避免冲突。

….masked_fill via decorator -part

Add @param_one_alias(["x", "input"]) decorator on masked_fill() to support
PyTorch-style paddle.masked_fill(input=x, mask=mask, value=v).

Use decorator approach instead of C++ sink (python_api_info.yaml) because
masked_fill's C++ op requires Tensor value but the Python API accepts scalar,
and C++ sink would bypass the scalar-to-Tensor conversion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Aidenwu0209 Aidenwu0209 force-pushed the api-compatibility-114 branch from 0a2db70 to 44b2d55 Compare February 10, 2026 11:04
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@59a8269). Learn more about missing BASE report.

Additional details and impacted files
@@             Coverage Diff             @@
##             develop    #77801   +/-   ##
===========================================
  Coverage           ?   100.00%           
===========================================
  Files              ?         1           
  Lines              ?         1           
  Branches           ?         0           
===========================================
  Hits               ?         1           
  Misses             ?         0           
  Partials           ?         0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Aidenwu0209 added a commit to Aidenwu0209/Paddle that referenced this pull request Feb 12, 2026
Aidenwu0209 added a commit to Aidenwu0209/Paddle that referenced this pull request Feb 12, 2026
@Aidenwu0209
Copy link
Contributor Author

@PaddlePaddle/ci-team 这次 #77801 做了两次 no-code 重新触发后,原先的 Linux-XPU/Linux-build/Mac-CPU 均已通过,但出现两个连续的非代码类失败,申请协助基础设施侧处理或管理员重跑:

  1. Slice / Slice test(重复出现性能阈值波动)
  1. Fleet Unit test (single card)(测试通过后超时退出)

PR 本次代码未改动(仅空提交触发 CI)。请帮忙看下是否可按 infra 波动处理并重跑,谢谢。

@Aidenwu0209
Copy link
Contributor Author

/re-run all-failed

@Aidenwu0209
Copy link
Contributor Author

/re-run slice

@Aidenwu0209 Aidenwu0209 force-pushed the api-compatibility-114 branch from 5ab19d7 to 1690f05 Compare February 13, 2026 06:01
@Aidenwu0209
Copy link
Contributor Author

/re-run all-failed

@zhwesky2010 zhwesky2010 merged commit 6bbddb2 into PaddlePaddle:develop Feb 15, 2026
65 of 66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Compatibility contributor External developers HappyOpenSource 快乐开源活动issue与PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants