Skip to content

Conversation

@youge325
Copy link
Contributor

@youge325 youge325 commented Dec 1, 2025

PR Category

User Experience

PR Types

New features

Description

  • paddle.bitwise_andpaddle.bitwise_and 添加参数别名
  • 为新增参数别名添加单测

@paddle-bot
Copy link

paddle-bot bot commented Dec 1, 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.

@youge325 youge325 changed the title [API Compatibility No.3、38] add parameter out and alias for bitwise_and -part [API Compatibility No.3、38] add parameter alias for bitwise_and -part Dec 1, 2025
@youge325
Copy link
Contributor Author

youge325 commented Dec 1, 2025

/re-run all-failed

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@09be8b7). Learn more about missing BASE report.

Files with missing lines Patch % Lines
python/paddle/tensor/logic.py 71.42% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (75.00%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop   #76705   +/-   ##
==========================================
  Coverage           ?   75.00%           
==========================================
  Files              ?        2           
  Lines              ?        8           
  Branches           ?        0           
==========================================
  Hits               ?        6           
  Misses             ?        2           
  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.

@youge325
Copy link
Contributor Author

youge325 commented Dec 1, 2025

/re-run all-failed

@youge325 youge325 force-pushed the a3 branch 2 times, most recently from 9395ccd to 33a1125 Compare December 1, 2025 14:47
@paddle-bot paddle-bot bot added the contributor External developers label Dec 1, 2025
@luotao1 luotao1 added HappyOpenSource 快乐开源活动issue与PR API Compatibility labels Dec 2, 2025
zhwesky2010
zhwesky2010 previously approved these changes Dec 2, 2025
SigureMo
SigureMo previously approved these changes Dec 2, 2025
Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

新增单侧 test_bitwise_op 失败

"""
if in_dynamic_or_pir_mode() and out is None:
return _C_ops.bitwise_and(x, y)
if in_dynamic_or_pir_mode():
Copy link
Contributor

Choose a reason for hiding this comment

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

这个还是走下沉较好,in_dynamic_or_pir_mode之外的分支可以移除。

)


@param_two_alias(["x", "input"], ["y", "other"])
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是也可以走下沉,python层的移除就行

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我试试

Copilot AI review requested due to automatic review settings December 3, 2025 14:15
@youge325
Copy link
Contributor Author

youge325 commented Dec 3, 2025

我在运行单测时会报以下错误:

Start testing: Dec 03 22:13 中国标准时间
----------------------------------------------------------
1192/2302 Testing: test_bitwise_op
1192/2302 Test: test_bitwise_op
Command: "D:/Program Files/CMake/bin/cmake.exe" "-E" "env" "PYTHONPATH=D:/Lenovo/Paddle/build/python" "D:/Users/Lenovo/AppData/Local/Programs/Python/Python310/python.exe" "D:/Lenovo/Paddle/tools/test_runner.py" "test_bitwise_op"
Directory: D:/Lenovo/Paddle/build/test/legacy_test
"test_bitwise_op" start time: Dec 03 22:13 中国标准时间
Output:
----------------------------------------------------------
I1203 22:13:21.871088 29436 program_interpreter.cc:257] New Executor is Running.
WARNING: Logging before InitGoogleLogging() is written to STDERR
W1203 22:13:21.871088 29436 gpu_resources.cc:116] Please NOTE: device: 0, GPU Compute Capability: 8.6, Driver API Version: 13.0, Runtime API Version: 13.0
Access violation
<end of output>
Test time =   5.05 sec
----------------------------------------------------------
Test Failed.
"test_bitwise_op" end time: Dec 03 22:13 中国标准时间
"test_bitwise_op" time elapsed: 00:00:05
----------------------------------------------------------

End testing: Dec 03 22:13 中国标准时间

错误信息太少,先试试流水线能不能跑通

Copilot finished reviewing on behalf of youge325 December 3, 2025 14:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds parameter aliases for paddle.bitwise_and and paddle.bitwise_and_ to improve API compatibility. The changes introduce input as an alias for the x parameter and other as an alias for the y parameter, allowing users to call these functions with more flexible parameter names (e.g., bitwise_and(input=x, other=y) instead of just bitwise_and(x=x, y=y)).

Key changes:

  • Removed Python wrapper functions and now import bitwise_and and bitwise_and_ directly from C++ ops
  • Added YAML configuration to define parameter aliases for both functions
  • Added comprehensive unit tests for the new parameter aliases

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
paddle/phi/ops/yaml/python_api_info.yaml Added YAML configuration entries for bitwise_and and bitwise_and_ with parameter alias mappings (xinput, yother)
python/paddle/tensor/logic.py Removed Python wrapper functions for bitwise_and and bitwise_and_; now importing these functions directly from _C_ops
test/legacy_test/test_bitwise_op.py Added test classes TestBitwiseAndAlias and TestBitwiseAndInplaceAlias to verify parameter alias functionality for both regular and inplace versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +180 to +194
def test_bitwise_and_with_out_parameter(self):
"""Test bitwise_and with out parameter"""
paddle.disable_static()
x_data = np.array([1, 2, 3], dtype=np.int32)
y_data = np.array([4, 2, 1], dtype=np.int32)
x = paddle.to_tensor(x_data)
y = paddle.to_tensor(y_data)
out = paddle.empty([3], dtype='int32')

# Test with out parameter
result = paddle.bitwise_and(x, y, out=out)
expected = np.bitwise_and(x_data, y_data)
np.testing.assert_array_equal(result.numpy(), expected)
np.testing.assert_array_equal(out.numpy(), expected)
paddle.enable_static()
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

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

This test appears to be testing the out parameter functionality. However, the C++ bitwise_and operation (defined in paddle/phi/ops/yaml/ops.yaml) only accepts (Tensor x, Tensor y) and doesn't support an out parameter. By removing the Python wrapper and directly importing from _C_ops, support for the out parameter is lost. This test will likely fail. If the out parameter needs to be supported for backward compatibility, a Python wrapper function should be kept (similar to bitwise_or in the same file).

Copilot uses AI. Check for mistakes.
@youge325 youge325 force-pushed the a3 branch 3 times, most recently from 868d325 to 28212fe Compare December 4, 2025 15:54
@youge325
Copy link
Contributor Author

youge325 commented Dec 5, 2025

/re-run all-failed

@youge325
Copy link
Contributor Author

youge325 commented Dec 5, 2025

/re-run all-failed

@youge325
Copy link
Contributor Author

youge325 commented Dec 7, 2025

/re-run all-failed

@youge325 youge325 changed the title [API Compatibility No.3、38] add parameter alias for bitwise_and -part [API Compatibility No.3、38] add parameter out and alias for bitwise_and -part Dec 7, 2025
@youge325
Copy link
Contributor Author

youge325 commented Dec 8, 2025

/re-run all-failed

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.

5 participants