Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
553630aa
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
553630aa
编写于
3月 27, 2023
作者:
L
Leo Chen
提交者:
GitHub
3月 27, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
unbind support bool dtype (#52080)
* unbind support bool dtype * replace np.array_equal
上级
a6449634
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
13 addition
and
2 deletion
+13
-2
paddle/phi/kernels/cpu/unbind_kernel.cc
paddle/phi/kernels/cpu/unbind_kernel.cc
+1
-0
paddle/phi/kernels/gpu/unbind_kernel.cu
paddle/phi/kernels/gpu/unbind_kernel.cu
+1
-0
python/paddle/fluid/tests/unittests/test_unbind_op.py
python/paddle/fluid/tests/unittests/test_unbind_op.py
+9
-0
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+2
-2
未找到文件。
paddle/phi/kernels/cpu/unbind_kernel.cc
浏览文件 @
553630aa
...
@@ -21,6 +21,7 @@ PD_REGISTER_KERNEL(unbind,
...
@@ -21,6 +21,7 @@ PD_REGISTER_KERNEL(unbind,
CPU
,
CPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
UnbindKernel
,
phi
::
UnbindKernel
,
bool
,
float
,
float
,
double
,
double
,
phi
::
dtype
::
float16
,
phi
::
dtype
::
float16
,
...
...
paddle/phi/kernels/gpu/unbind_kernel.cu
浏览文件 @
553630aa
...
@@ -21,6 +21,7 @@ PD_REGISTER_KERNEL(unbind,
...
@@ -21,6 +21,7 @@ PD_REGISTER_KERNEL(unbind,
GPU
,
GPU
,
ALL_LAYOUT
,
ALL_LAYOUT
,
phi
::
UnbindKernel
,
phi
::
UnbindKernel
,
bool
,
float
,
float
,
double
,
double
,
phi
::
dtype
::
float16
,
phi
::
dtype
::
float16
,
...
...
python/paddle/fluid/tests/unittests/test_unbind_op.py
浏览文件 @
553630aa
...
@@ -201,6 +201,7 @@ class TestUnbindOp4(TestUnbindOp):
...
@@ -201,6 +201,7 @@ class TestUnbindOp4(TestUnbindOp):
class
TestUnbindBF16Op
(
OpTest
):
class
TestUnbindBF16Op
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
paddle
.
disable_static
()
self
.
_set_op_type
()
self
.
_set_op_type
()
self
.
python_api
=
paddle
.
unbind
self
.
python_api
=
paddle
.
unbind
self
.
dtype
=
self
.
get_dtype
()
self
.
dtype
=
self
.
get_dtype
()
...
@@ -247,5 +248,13 @@ class TestUnbindAxisError(unittest.TestCase):
...
@@ -247,5 +248,13 @@ class TestUnbindAxisError(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
test_invalid_axis
)
self
.
assertRaises
(
ValueError
,
test_invalid_axis
)
class
TestUnbindBool
(
unittest
.
TestCase
):
def
test_bool
(
self
):
x
=
paddle
.
to_tensor
([[
True
,
True
],
[
False
,
False
]])
xs
=
paddle
.
unbind
(
x
,
axis
=
0
)
self
.
assertEqual
(
len
(
xs
),
2
)
np
.
testing
.
assert_array_equal
(
xs
[
0
].
numpy
(),
[
True
,
True
])
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
python/paddle/tensor/manipulation.py
浏览文件 @
553630aa
...
@@ -2759,7 +2759,7 @@ def unbind(input, axis=0):
...
@@ -2759,7 +2759,7 @@ def unbind(input, axis=0):
Removes a tensor dimension, then split the input tensor into multiple sub-Tensors.
Removes a tensor dimension, then split the input tensor into multiple sub-Tensors.
Args:
Args:
input (Tensor): The input variable which is an N-D Tensor, data type being float16, float32, float64, int32 or int64.
input (Tensor): The input variable which is an N-D Tensor, data type being
bool,
float16, float32, float64, int32 or int64.
axis (int32|int64, optional): A scalar with type ``int32|int64`` shape [1]. The dimension along which to unbind.
axis (int32|int64, optional): A scalar with type ``int32|int64`` shape [1]. The dimension along which to unbind.
If :math:`axis < 0`, the dimension to unbind along is :math:`rank(input) + axis`. Default is 0.
If :math:`axis < 0`, the dimension to unbind along is :math:`rank(input) + axis`. Default is 0.
Returns:
Returns:
...
@@ -2808,7 +2808,7 @@ def unbind(input, axis=0):
...
@@ -2808,7 +2808,7 @@ def unbind(input, axis=0):
check_dtype
(
check_dtype
(
dtype
,
dtype
,
'unbind'
,
'unbind'
,
[
'float16'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
[
'
bool'
,
'
float16'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
'unbind'
,
'unbind'
,
)
)
outs
=
[
outs
=
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录