Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wmsofts
Paddle
提交
b94fe95a
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 搜索 >>
未验证
提交
b94fe95a
编写于
3月 17, 2023
作者:
I
Infinity_lee
提交者:
GitHub
3月 17, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【Hackathon No58】fix atan2 (#51185)
上级
b647c2f0
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
2 deletion
+34
-2
paddle/phi/kernels/gpu/atan2_grad_kernel.cu
paddle/phi/kernels/gpu/atan2_grad_kernel.cu
+2
-1
paddle/phi/kernels/gpu/atan2_kernel.cu
paddle/phi/kernels/gpu/atan2_kernel.cu
+1
-0
paddle/phi/kernels/impl/atan2_kernel_impl.h
paddle/phi/kernels/impl/atan2_kernel_impl.h
+1
-0
python/paddle/fluid/tests/unittests/test_atan2_op.py
python/paddle/fluid/tests/unittests/test_atan2_op.py
+30
-1
未找到文件。
paddle/phi/kernels/gpu/atan2_grad_kernel.cu
浏览文件 @
b94fe95a
...
...
@@ -22,4 +22,5 @@ PD_REGISTER_KERNEL(atan2_grad,
phi
::
Atan2GradKernel
,
float
,
double
,
phi
::
dtype
::
float16
)
{}
phi
::
dtype
::
float16
,
phi
::
dtype
::
bfloat16
)
{}
paddle/phi/kernels/gpu/atan2_kernel.cu
浏览文件 @
b94fe95a
...
...
@@ -23,6 +23,7 @@ PD_REGISTER_KERNEL(atan2,
float
,
double
,
phi
::
dtype
::
float16
,
phi
::
dtype
::
bfloat16
,
int
,
int64_t
)
{
kernel
->
OutputAt
(
0
).
SetDataType
(
phi
::
DataType
::
UNDEFINED
);
...
...
paddle/phi/kernels/impl/atan2_kernel_impl.h
浏览文件 @
b94fe95a
...
...
@@ -15,6 +15,7 @@
#pragma once
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/device_context.h"
#include "paddle/phi/kernels/atan2_kernel.h"
#include "paddle/phi/kernels/funcs/for_range.h"
...
...
python/paddle/fluid/tests/unittests/test_atan2_op.py
浏览文件 @
b94fe95a
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
eager_op_test
import
OpTest
from
eager_op_test
import
OpTest
,
convert_float_to_uint16
import
paddle
import
paddle.fluid.core
as
core
...
...
@@ -129,6 +129,35 @@ class TestAtan2API(unittest.TestCase):
run
(
place
)
@
unittest
.
skipIf
(
not
core
.
is_compiled_with_cuda
()
or
not
core
.
is_bfloat16_supported
(
core
.
CUDAPlace
(
0
)),
"core is not compiled with CUDA and not support the bfloat16"
,
)
class
TestAtan2BF16OP
(
OpTest
):
def
setUp
(
self
):
self
.
op_type
=
'atan2'
self
.
python_api
=
paddle
.
atan2
self
.
dtype
=
np
.
uint16
x1
=
np
.
random
.
uniform
(
-
1
,
-
0.1
,
[
15
,
17
]).
astype
(
'float32'
)
x2
=
np
.
random
.
uniform
(
0.1
,
1
,
[
15
,
17
]).
astype
(
'float32'
)
out
=
np
.
arctan2
(
x1
,
x2
)
self
.
inputs
=
{
'X1'
:
convert_float_to_uint16
(
x1
),
'X2'
:
convert_float_to_uint16
(
x2
),
}
self
.
outputs
=
{
'Out'
:
convert_float_to_uint16
(
out
)}
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
,
[
'X1'
,
'X2'
],
'Out'
)
class
TestAtan2Error
(
unittest
.
TestCase
):
def
test_mismatch
(
self
):
paddle
.
enable_static
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录