Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
f1bb80cc
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
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看板
提交
f1bb80cc
编写于
1月 04, 2023
作者:
D
DesmonDay
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix grad and add value assertion
上级
7d315faa
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
2 deletion
+14
-2
paddle/phi/kernels/gpu/argsort_grad_kernel.cu
paddle/phi/kernels/gpu/argsort_grad_kernel.cu
+1
-1
paddle/phi/kernels/xpu/argsort_grad_kernel.cc
paddle/phi/kernels/xpu/argsort_grad_kernel.cc
+1
-1
python/paddle/fluid/tests/unittests/test_zero_dim_tensor.py
python/paddle/fluid/tests/unittests/test_zero_dim_tensor.py
+8
-0
python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py
...dle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py
+4
-0
未找到文件。
paddle/phi/kernels/gpu/argsort_grad_kernel.cu
浏览文件 @
f1bb80cc
...
@@ -150,7 +150,7 @@ void ArgsortGradKernel(const Context& dev_ctx,
...
@@ -150,7 +150,7 @@ void ArgsortGradKernel(const Context& dev_ctx,
int64_t
size
=
in_grad
->
numel
();
int64_t
size
=
in_grad
->
numel
();
if
(
rank
==
0
)
{
if
(
rank
==
0
)
{
phi
::
funcs
::
set_constant
(
dev_ctx
,
in_grad
,
1.0
);
phi
::
Copy
<
Context
>
(
dev_ctx
,
out_grad
,
dev_ctx
.
GetPlace
(),
false
,
in_grad
);
return
;
return
;
}
}
...
...
paddle/phi/kernels/xpu/argsort_grad_kernel.cc
浏览文件 @
f1bb80cc
...
@@ -43,7 +43,7 @@ void ArgsortGradKernel(const Context& dev_ctx,
...
@@ -43,7 +43,7 @@ void ArgsortGradKernel(const Context& dev_ctx,
if
(
out_grad
.
numel
()
==
0
)
return
;
if
(
out_grad
.
numel
()
==
0
)
return
;
if
(
rank
==
0
)
{
if
(
rank
==
0
)
{
phi
::
funcs
::
set_constant
(
dev_ctx
,
in_grad
,
1.0
);
phi
::
Copy
<
Context
>
(
dev_ctx
,
out_grad
,
dev_ctx
.
GetPlace
(),
false
,
in_grad
);
return
;
return
;
}
}
...
...
python/paddle/fluid/tests/unittests/test_zero_dim_tensor.py
浏览文件 @
f1bb80cc
...
@@ -868,10 +868,14 @@ class TestSundryAPI(unittest.TestCase):
...
@@ -868,10 +868,14 @@ class TestSundryAPI(unittest.TestCase):
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out1
.
numpy
(),
x1
.
numpy
())
self
.
assertEqual
(
out2
.
numpy
(),
x2
.
numpy
())
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
numpy
(),
1
)
self
.
assertEqual
(
x2
.
grad
.
numpy
(),
1
)
def
test_argsort
(
self
):
def
test_argsort
(
self
):
x1
=
paddle
.
rand
([])
x1
=
paddle
.
rand
([])
...
@@ -886,10 +890,14 @@ class TestSundryAPI(unittest.TestCase):
...
@@ -886,10 +890,14 @@ class TestSundryAPI(unittest.TestCase):
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out1
.
numpy
(),
0
)
self
.
assertEqual
(
out2
.
numpy
(),
0
)
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
numpy
(),
0
)
self
.
assertEqual
(
x2
.
grad
.
numpy
(),
0
)
class
TestSundryAPIStatic
(
unittest
.
TestCase
):
class
TestSundryAPIStatic
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py
浏览文件 @
f1bb80cc
...
@@ -659,10 +659,14 @@ class TestSundryAPI(unittest.TestCase):
...
@@ -659,10 +659,14 @@ class TestSundryAPI(unittest.TestCase):
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out1
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out2
.
shape
,
[])
self
.
assertEqual
(
out1
.
numpy
(),
x1
.
numpy
())
self
.
assertEqual
(
out2
.
numpy
(),
x2
.
numpy
())
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out1
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
out2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x2
.
grad
.
shape
,
[])
self
.
assertEqual
(
x1
.
grad
.
numpy
(),
1
)
self
.
assertEqual
(
x2
.
grad
.
numpy
(),
1
)
def
test_argsort
(
self
):
def
test_argsort
(
self
):
x1
=
paddle
.
rand
([])
x1
=
paddle
.
rand
([])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录