Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c145fd1e
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看板
未验证
提交
c145fd1e
编写于
3月 28, 2023
作者:
H
houj04
提交者:
GitHub
3月 28, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix int8 support for full kernel (#52194)
* fix int8 support for full kernel * fix ut.
上级
4118ab89
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
7 addition
and
23 deletion
+7
-23
paddle/phi/kernels/gpu/full_kernel.cu
paddle/phi/kernels/gpu/full_kernel.cu
+1
-0
python/paddle/fluid/tests/unittests/test_ones_op.py
python/paddle/fluid/tests/unittests/test_ones_op.py
+0
-6
python/paddle/fluid/tests/unittests/test_zeros_op.py
python/paddle/fluid/tests/unittests/test_zeros_op.py
+2
-16
python/paddle/tensor/creation.py
python/paddle/tensor/creation.py
+4
-1
未找到文件。
paddle/phi/kernels/gpu/full_kernel.cu
浏览文件 @
c145fd1e
...
@@ -116,6 +116,7 @@ PD_REGISTER_KERNEL(full,
...
@@ -116,6 +116,7 @@ PD_REGISTER_KERNEL(full,
phi
::
FullKernel
,
phi
::
FullKernel
,
float
,
float
,
double
,
double
,
int8_t
,
uint8_t
,
uint8_t
,
int16_t
,
int16_t
,
int
,
int
,
...
...
python/paddle/fluid/tests/unittests/test_ones_op.py
浏览文件 @
c145fd1e
...
@@ -75,12 +75,6 @@ class ApiOnesZerosError(unittest.TestCase):
...
@@ -75,12 +75,6 @@ class ApiOnesZerosError(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
test_error3
)
self
.
assertRaises
(
TypeError
,
test_error3
)
def
test_error4
():
with
paddle
.
static
.
program_guard
(
paddle
.
static
.
Program
()):
ones
=
paddle
.
ones
(
shape
=
[
10
],
dtype
=
"int8"
)
self
.
assertRaises
(
TypeError
,
test_error4
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_zeros_op.py
浏览文件 @
c145fd1e
...
@@ -21,14 +21,6 @@ from paddle import fluid
...
@@ -21,14 +21,6 @@ from paddle import fluid
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid
import
Program
,
program_guard
class
TestZerosOpError
(
unittest
.
TestCase
):
def
test_errors
(
self
):
with
program_guard
(
Program
(),
Program
()):
shape
=
[
4
]
dtype
=
'int8'
self
.
assertRaises
(
TypeError
,
fluid
.
layers
.
zeros
,
shape
,
dtype
)
class
ApiZerosTest
(
unittest
.
TestCase
):
class
ApiZerosTest
(
unittest
.
TestCase
):
def
test_out
(
self
):
def
test_out
(
self
):
with
program_guard
(
Program
()):
with
program_guard
(
Program
()):
...
@@ -46,11 +38,11 @@ class ApiZerosTest(unittest.TestCase):
...
@@ -46,11 +38,11 @@ class ApiZerosTest(unittest.TestCase):
expected_result
=
np
.
zeros
(
10
,
dtype
=
'int64'
)
expected_result
=
np
.
zeros
(
10
,
dtype
=
'int64'
)
self
.
assertEqual
((
result
==
expected_result
).
all
(),
True
)
self
.
assertEqual
((
result
==
expected_result
).
all
(),
True
)
with
program_guard
(
Program
()):
with
program_guard
(
Program
()):
zeros
=
paddle
.
zeros
(
shape
=
[
10
],
dtype
=
'int
64
'
)
zeros
=
paddle
.
zeros
(
shape
=
[
10
],
dtype
=
'int
8
'
)
place
=
paddle
.
CPUPlace
()
place
=
paddle
.
CPUPlace
()
exe
=
paddle
.
static
.
Executor
(
place
)
exe
=
paddle
.
static
.
Executor
(
place
)
(
result
,)
=
exe
.
run
(
fetch_list
=
[
zeros
])
(
result
,)
=
exe
.
run
(
fetch_list
=
[
zeros
])
expected_result
=
np
.
zeros
(
10
,
dtype
=
'int
64
'
)
expected_result
=
np
.
zeros
(
10
,
dtype
=
'int
8
'
)
self
.
assertEqual
((
result
==
expected_result
).
all
(),
True
)
self
.
assertEqual
((
result
==
expected_result
).
all
(),
True
)
with
program_guard
(
Program
()):
with
program_guard
(
Program
()):
out_np
=
np
.
zeros
(
shape
=
1
,
dtype
=
'float32'
)
out_np
=
np
.
zeros
(
shape
=
1
,
dtype
=
'float32'
)
...
@@ -78,12 +70,6 @@ class ApiZerosError(unittest.TestCase):
...
@@ -78,12 +70,6 @@ class ApiZerosError(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
test_error1
)
self
.
assertRaises
(
TypeError
,
test_error1
)
def
test_error2
():
with
paddle
.
static
.
program_guard
(
fluid
.
Program
()):
ones
=
fluid
.
layers
.
zeros
(
shape
=
[
10
],
dtype
=
'int8'
)
self
.
assertRaises
(
TypeError
,
test_error2
)
def
test_shape_errors
(
self
):
def
test_shape_errors
(
self
):
with
fluid
.
dygraph
.
guard
():
with
fluid
.
dygraph
.
guard
():
try
:
try
:
...
...
python/paddle/tensor/creation.py
浏览文件 @
c145fd1e
...
@@ -881,7 +881,7 @@ def fill_constant(shape, dtype, value, force_cpu=False, out=None, name=None):
...
@@ -881,7 +881,7 @@ def fill_constant(shape, dtype, value, force_cpu=False, out=None, name=None):
attrs
=
{
'force_cpu'
:
force_cpu
}
attrs
=
{
'force_cpu'
:
force_cpu
}
dtype
=
convert_dtype
(
dtype
)
dtype
=
convert_dtype
(
dtype
)
if
not
isinstance
(
value
,
Variable
):
if
not
isinstance
(
value
,
Variable
):
if
dtype
in
[
'uint8'
,
'int16'
,
'int32'
,
'int64'
]:
if
dtype
in
[
'
int8'
,
'
uint8'
,
'int16'
,
'int32'
,
'int64'
]:
attrs
[
'str_value'
]
=
str
(
int
(
value
))
attrs
[
'str_value'
]
=
str
(
int
(
value
))
attrs
[
'value'
]
=
int
(
value
)
attrs
[
'value'
]
=
int
(
value
)
else
:
else
:
...
@@ -904,6 +904,7 @@ def fill_constant(shape, dtype, value, force_cpu=False, out=None, name=None):
...
@@ -904,6 +904,7 @@ def fill_constant(shape, dtype, value, force_cpu=False, out=None, name=None):
'float16'
,
'float16'
,
'float32'
,
'float32'
,
'float64'
,
'float64'
,
'int8'
,
'uint8'
,
'uint8'
,
'int16'
,
'int16'
,
'int32'
,
'int32'
,
...
@@ -2045,6 +2046,7 @@ def assign(x, output=None):
...
@@ -2045,6 +2046,7 @@ def assign(x, output=None):
'int32'
,
'int32'
,
'int64'
,
'int64'
,
'uint8'
,
'uint8'
,
'int8'
,
'bool'
,
'bool'
,
],
],
'assign'
,
'assign'
,
...
@@ -2218,6 +2220,7 @@ def _memcpy(input, place=None, output=None):
...
@@ -2218,6 +2220,7 @@ def _memcpy(input, place=None, output=None):
'int32'
,
'int32'
,
'int64'
,
'int64'
,
'uint8'
,
'uint8'
,
'int8'
,
'bool'
,
'bool'
,
],
],
'memcpy'
,
'memcpy'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录