-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API Compatibility No.3、38] add parameter out and alias for bitwise_and -part #76705
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
base: develop
Are you sure you want to change the base?
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
/re-run all-failed |
Codecov Report❌ Patch coverage is
❌ 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. 🚀 New features to boost your workflow:
|
|
/re-run all-failed |
9395ccd to
33a1125
Compare
luotao1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新增单侧 test_bitwise_op 失败
python/paddle/tensor/logic.py
Outdated
| """ | ||
| if in_dynamic_or_pir_mode() and out is None: | ||
| return _C_ops.bitwise_and(x, y) | ||
| if in_dynamic_or_pir_mode(): |
There was a problem hiding this comment.
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"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是也可以走下沉,python层的移除就行
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我试试
|
我在运行单测时会报以下错误: 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 中国标准时间错误信息太少,先试试流水线能不能跑通 |
There was a problem hiding this 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_andandbitwise_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 (x → input, y → other) |
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.
| 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() |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
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).
868d325 to
28212fe
Compare
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run all-failed |
|
/re-run all-failed |
PR Category
User Experience
PR Types
New features
Description
paddle.bitwise_and和paddle.bitwise_and添加参数别名