Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3eefb097
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3eefb097
编写于
3月 16, 2022
作者:
P
phlrain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update; test=develop
上级
c1c6b869
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
39 addition
and
24 deletion
+39
-24
python/paddle/fluid/tests/unittests/test_bitwise_op.py
python/paddle/fluid/tests/unittests/test_bitwise_op.py
+6
-0
python/paddle/tensor/logic.py
python/paddle/tensor/logic.py
+10
-1
python/paddle/utils/code_gen/api.yaml
python/paddle/utils/code_gen/api.yaml
+23
-23
未找到文件。
python/paddle/fluid/tests/unittests/test_bitwise_op.py
浏览文件 @
3eefb097
...
@@ -24,6 +24,7 @@ paddle.enable_static()
...
@@ -24,6 +24,7 @@ paddle.enable_static()
class
TestBitwiseAnd
(
OpTest
):
class
TestBitwiseAnd
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_and"
self
.
op_type
=
"bitwise_and"
self
.
python_api
=
paddle
.
bitwise_and
self
.
init_dtype
()
self
.
init_dtype
()
self
.
init_shape
()
self
.
init_shape
()
self
.
init_bound
()
self
.
init_bound
()
...
@@ -94,6 +95,7 @@ class TestBitwiseAndInt64(TestBitwiseAnd):
...
@@ -94,6 +95,7 @@ class TestBitwiseAndInt64(TestBitwiseAnd):
class
TestBitwiseAndBool
(
TestBitwiseAnd
):
class
TestBitwiseAndBool
(
TestBitwiseAnd
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_and"
self
.
op_type
=
"bitwise_and"
self
.
python_api
=
paddle
.
bitwise_and
self
.
init_shape
()
self
.
init_shape
()
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
...
@@ -108,6 +110,7 @@ class TestBitwiseAndBool(TestBitwiseAnd):
...
@@ -108,6 +110,7 @@ class TestBitwiseAndBool(TestBitwiseAnd):
class
TestBitwiseOr
(
OpTest
):
class
TestBitwiseOr
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_or"
self
.
op_type
=
"bitwise_or"
self
.
python_api
=
paddle
.
bitwise_or
self
.
init_dtype
()
self
.
init_dtype
()
self
.
init_shape
()
self
.
init_shape
()
self
.
init_bound
()
self
.
init_bound
()
...
@@ -178,6 +181,7 @@ class TestBitwiseOrInt64(TestBitwiseOr):
...
@@ -178,6 +181,7 @@ class TestBitwiseOrInt64(TestBitwiseOr):
class
TestBitwiseOrBool
(
TestBitwiseOr
):
class
TestBitwiseOrBool
(
TestBitwiseOr
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_or"
self
.
op_type
=
"bitwise_or"
self
.
python_api
=
paddle
.
bitwise_or
self
.
init_shape
()
self
.
init_shape
()
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
...
@@ -192,6 +196,7 @@ class TestBitwiseOrBool(TestBitwiseOr):
...
@@ -192,6 +196,7 @@ class TestBitwiseOrBool(TestBitwiseOr):
class
TestBitwiseXor
(
OpTest
):
class
TestBitwiseXor
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_xor"
self
.
op_type
=
"bitwise_xor"
self
.
python_api
=
paddle
.
bitwise_xor
self
.
init_dtype
()
self
.
init_dtype
()
self
.
init_shape
()
self
.
init_shape
()
self
.
init_bound
()
self
.
init_bound
()
...
@@ -262,6 +267,7 @@ class TestBitwiseXorInt64(TestBitwiseXor):
...
@@ -262,6 +267,7 @@ class TestBitwiseXorInt64(TestBitwiseXor):
class
TestBitwiseXorBool
(
TestBitwiseXor
):
class
TestBitwiseXorBool
(
TestBitwiseXor
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
op_type
=
"bitwise_xor"
self
.
op_type
=
"bitwise_xor"
self
.
python_api
=
paddle
.
bitwise_xor
self
.
init_shape
()
self
.
init_shape
()
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
x
=
np
.
random
.
choice
([
True
,
False
],
self
.
x_shape
)
...
...
python/paddle/tensor/logic.py
浏览文件 @
3eefb097
...
@@ -503,6 +503,9 @@ def bitwise_and(x, y, out=None, name=None):
...
@@ -503,6 +503,9 @@ def bitwise_and(x, y, out=None, name=None):
res = paddle.bitwise_and(x, y)
res = paddle.bitwise_and(x, y)
print(res) # [0, 2, 1]
print(res) # [0, 2, 1]
"""
"""
if
_in_eager_mode
()
and
out
==
None
:
return
_C_ops
.
final_state_bitwise_and
(
x
,
y
)
return
_bitwise_op
(
return
_bitwise_op
(
op_name
=
"bitwise_and"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
op_name
=
"bitwise_and"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
...
@@ -529,6 +532,9 @@ def bitwise_or(x, y, out=None, name=None):
...
@@ -529,6 +532,9 @@ def bitwise_or(x, y, out=None, name=None):
res = paddle.bitwise_or(x, y)
res = paddle.bitwise_or(x, y)
print(res) # [-1, -1, -3]
print(res) # [-1, -1, -3]
"""
"""
if
_in_eager_mode
()
and
out
==
None
:
return
_C_ops
.
final_state_bitwise_or
(
x
,
y
)
return
_bitwise_op
(
return
_bitwise_op
(
op_name
=
"bitwise_or"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
op_name
=
"bitwise_or"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
...
@@ -555,6 +561,9 @@ def bitwise_xor(x, y, out=None, name=None):
...
@@ -555,6 +561,9 @@ def bitwise_xor(x, y, out=None, name=None):
res = paddle.bitwise_xor(x, y)
res = paddle.bitwise_xor(x, y)
print(res) # [-1, -3, -4]
print(res) # [-1, -3, -4]
"""
"""
if
_in_eager_mode
()
and
out
==
None
:
return
_C_ops
.
final_state_bitwise_xor
(
x
,
y
)
return
_bitwise_op
(
return
_bitwise_op
(
op_name
=
"bitwise_xor"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
op_name
=
"bitwise_xor"
,
x
=
x
,
y
=
y
,
name
=
name
,
out
=
out
,
binary_op
=
True
)
...
@@ -580,7 +589,7 @@ def bitwise_not(x, out=None, name=None):
...
@@ -580,7 +589,7 @@ def bitwise_not(x, out=None, name=None):
print(res) # [4, 0, -2]
print(res) # [4, 0, -2]
"""
"""
if
_in_eager_mode
()
and
out
==
None
:
if
_in_eager_mode
()
and
out
==
None
:
return
_C_op
.
final_state_bitwise_not
(
x
)
return
_C_op
s
.
final_state_bitwise_not
(
x
)
return
_bitwise_op
(
return
_bitwise_op
(
op_name
=
"bitwise_not"
,
x
=
x
,
y
=
None
,
name
=
name
,
out
=
out
,
binary_op
=
False
)
op_name
=
"bitwise_not"
,
x
=
x
,
y
=
None
,
name
=
name
,
out
=
out
,
binary_op
=
False
)
...
...
python/paddle/utils/code_gen/api.yaml
浏览文件 @
3eefb097
...
@@ -538,32 +538,32 @@
...
@@ -538,32 +538,32 @@
# bitwise_and
# bitwise_and
#
- api : bitwise_and
-
api
:
bitwise_and
#
args : (Tensor x, Tensor y)
args
:
(Tensor x, Tensor y)
#
output : Tensor
output
:
Tensor
#
infer_meta :
infer_meta
:
# func : Bi
twiseInferMeta
func
:
Elemen
twiseInferMeta
#
kernel :
kernel
:
#
func : bitwise_and
func
:
bitwise_and
#
#
bitwise_or
# bitwise_or
#
- api : bitwise_or
-
api
:
bitwise_or
#
args : (Tensor x, Tensor y)
args
:
(Tensor x, Tensor y)
#
output : Tensor
output
:
Tensor
#
infer_meta :
infer_meta
:
# func : Bi
twiseInferMeta
func
:
Elemen
twiseInferMeta
#
kernel :
kernel
:
#
func : bitwise_or
func
:
bitwise_or
#
#
bitwise_xor
# bitwise_xor
#
- api : bitwise_xor
-
api
:
bitwise_xor
#
args : (Tensor x, Tensor y)
args
:
(Tensor x, Tensor y)
#
output : Tensor
output
:
Tensor
#
infer_meta :
infer_meta
:
# func : Bi
twiseInferMeta
func
:
Elemen
twiseInferMeta
#
kernel :
kernel
:
#
func : bitwise_xor
func
:
bitwise_xor
# bitwise_not
# bitwise_not
-
api
:
bitwise_not
-
api
:
bitwise_not
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录