Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wmsofts
Paddle
提交
6c650445
P
Paddle
项目概览
wmsofts
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
6c650445
编写于
3月 08, 2023
作者:
Y
yangjianfengo1
提交者:
GitHub
3月 08, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
AMP tile_op & Test (#51193)
* tile_op * fix bfloat16 x
上级
37dbbbd1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
2 deletion
+56
-2
python/paddle/fluid/tests/unittests/test_tile_op.py
python/paddle/fluid/tests/unittests/test_tile_op.py
+47
-1
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+9
-1
未找到文件。
python/paddle/fluid/tests/unittests/test_tile_op.py
浏览文件 @
6c650445
...
...
@@ -17,7 +17,7 @@ import unittest
import
gradient_checker
import
numpy
as
np
from
decorator_helper
import
prog_scope
from
eager_op_test
import
OpTest
from
eager_op_test
import
OpTest
,
convert_float_to_uint16
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -196,6 +196,52 @@ class TestTileOpInteger(OpTest):
self
.
check_output
()
class
TestTileOpFloat16
(
OpTest
):
def
setUp
(
self
):
self
.
op_type
=
"tile"
self
.
dtype
=
np
.
float16
self
.
__class__
.
op_type
=
self
.
op_type
self
.
python_api
=
paddle
.
tile
self
.
inputs
=
{
'X'
:
np
.
random
.
uniform
(
10
,
size
=
(
100
,
4
,
5
)).
astype
(
self
.
dtype
)
}
self
.
attrs
=
{
'repeat_times'
:
[
2
,
1
,
4
]}
output
=
np
.
tile
(
self
.
inputs
[
'X'
],
(
2
,
1
,
4
))
self
.
outputs
=
{
'Out'
:
output
}
def
test_check_output
(
self
):
self
.
check_output
()
def
test_check_grad
(
self
):
self
.
check_grad
([
'X'
],
'Out'
)
@
unittest
.
skipIf
(
not
core
.
is_compiled_with_cuda
()
or
not
core
.
is_bfloat16_supported
(
core
.
CUDAPlace
(
0
)),
"core is not complied with CUDA and not support the bfloat16"
,
)
class
TestWhereOpBFloat16
(
OpTest
):
def
setUp
(
self
):
self
.
op_type
=
'tile'
self
.
dtype
=
np
.
uint16
self
.
__class__
.
op_type
=
self
.
op_type
self
.
python_api
=
paddle
.
tile
x
=
np
.
random
.
uniform
(
10
,
size
=
(
100
,
4
,
5
)).
astype
(
np
.
float32
)
output
=
np
.
tile
(
x
,
(
2
,
1
,
4
))
self
.
inputs
=
{
'X'
:
convert_float_to_uint16
(
x
)}
self
.
attrs
=
{
'repeat_times'
:
[
2
,
1
,
4
]}
self
.
outputs
=
{
'Out'
:
convert_float_to_uint16
(
output
)}
def
test_check_output
(
self
):
place
=
core
.
CUDAPlace
(
0
)
self
.
check_output_with_place
(
place
)
def
test_check_grad
(
self
):
place
=
core
.
CUDAPlace
(
0
)
self
.
check_grad_with_place
(
place
,
[
'X'
],
'Out'
)
# Situation 5: input x is Bool
class
TestTileOpBoolean
(
OpTest
):
def
setUp
(
self
):
...
...
python/paddle/tensor/manipulation.py
浏览文件 @
6c650445
...
...
@@ -3156,7 +3156,15 @@ def tile(x, repeat_times, name=None):
check_variable_and_dtype
(
x
,
'x'
,
[
'bool'
,
'float16'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
],
[
'bool'
,
'float16'
,
'bfloat16'
,
'float32'
,
'float64'
,
'int32'
,
'int64'
,
],
'tile'
,
)
if
convert_dtype
(
x
.
dtype
)
==
'bool'
and
not
x
.
stop_gradient
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录