Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
50e60e87
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看板
未验证
提交
50e60e87
编写于
9月 10, 2020
作者:
S
Steffy-zxf
提交者:
GitHub
9月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update error info for selected_rows_functor
update error info for selected_rows_functor
上级
7c8e980a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
198 addition
and
45 deletion
+198
-45
paddle/fluid/operators/math/selected_rows_functor.cc
paddle/fluid/operators/math/selected_rows_functor.cc
+103
-24
paddle/fluid/operators/math/selected_rows_functor.cu
paddle/fluid/operators/math/selected_rows_functor.cu
+92
-20
paddle/fluid/operators/math/selected_rows_functor_test.cu.cc
paddle/fluid/operators/math/selected_rows_functor_test.cu.cc
+3
-1
未找到文件。
paddle/fluid/operators/math/selected_rows_functor.cc
浏览文件 @
50e60e87
...
...
@@ -29,7 +29,12 @@ struct SelectedRowsAdd<platform::CPUDeviceContext, T> {
const
framework
::
SelectedRows
&
input2
,
framework
::
SelectedRows
*
output
)
{
auto
in1_height
=
input1
.
height
();
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
.
height
());
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
.
height
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
input2
.
height
()));
output
->
set_height
(
in1_height
);
auto
&
in1_rows
=
input1
.
rows
();
...
...
@@ -47,15 +52,31 @@ struct SelectedRowsAdd<platform::CPUDeviceContext, T> {
auto
&
in2_value
=
input2
.
value
();
auto
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
());
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
());
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
()));
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
(),
platform
::
errors
::
InvalidArgument
(
"The input and oupput width must be equal."
"But recieved input width = [%d], output width = [%d]"
,
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
()));
auto
in1_place
=
input1
.
place
();
PADDLE_ENFORCE
(
platform
::
is_cpu_place
(
in1_place
));
PADDLE_ENFORCE_EQ
(
platform
::
is_cpu_place
(
in1_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the CPU place."
));
auto
in2_place
=
input2
.
place
();
PADDLE_ENFORCE
(
platform
::
is_cpu_place
(
in2_place
));
PADDLE_ENFORCE_EQ
(
platform
::
is_cpu_place
(
in2_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the CPU place."
));
auto
out_place
=
context
.
GetPlace
();
PADDLE_ENFORCE
(
platform
::
is_cpu_place
(
out_place
));
PADDLE_ENFORCE_EQ
(
platform
::
is_cpu_place
(
out_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the CPU place."
));
auto
*
out_data
=
out_value
->
data
<
T
>
();
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
...
...
@@ -82,15 +103,35 @@ struct SelectedRowsAddTensor<platform::CPUDeviceContext, T> {
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
.
dims
();
auto
out_dims
=
output
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
out_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
PADDLE_ENFORCE_EQ
(
in1_height
,
out_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The input and output height must be equal."
"But recieved input height = [%d], output height = [%d]"
,
in1_height
,
out_dims
[
0
]));
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
.
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
output
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
.
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
.
numel
()
/
in1_height
));
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
output
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The input and output width must be equal."
"But recieved input width = [%d], output width = [%d]"
,
in1_row_numel
,
output
->
numel
()
/
in1_height
));
SetConstant
<
platform
::
CPUDeviceContext
,
T
>
functor
;
functor
(
context
,
output
,
0.0
);
...
...
@@ -121,7 +162,12 @@ struct SelectedRowsAddTo<platform::CPUDeviceContext, T> {
const
int64_t
input2_offset
,
framework
::
SelectedRows
*
input2
)
{
auto
in1_height
=
input1
.
height
();
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
());
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
input2
->
height
()));
auto
&
in1_rows
=
input1
.
rows
();
auto
&
in2_rows
=
*
(
input2
->
mutable_rows
());
...
...
@@ -133,9 +179,13 @@ struct SelectedRowsAddTo<platform::CPUDeviceContext, T> {
in2_rows
.
Extend
(
in1_rows
.
begin
(),
in1_rows
.
end
());
auto
in1_place
=
input1
.
place
();
PADDLE_ENFORCE
(
platform
::
is_cpu_place
(
in1_place
));
PADDLE_ENFORCE_EQ
(
platform
::
is_cpu_place
(
in1_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the CPU place."
));
auto
in2_place
=
input2
->
place
();
PADDLE_ENFORCE
(
platform
::
is_cpu_place
(
in2_place
));
PADDLE_ENFORCE_EQ
(
platform
::
is_cpu_place
(
in2_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the CPU place."
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
in2_data
=
in2_value
->
data
<
T
>
();
...
...
@@ -163,7 +213,12 @@ struct SelectedRowsSumTo<platform::CPUDeviceContext, T> {
auto
&
in_rows
=
(
*
iter
)
->
rows
();
size
+=
in_rows
.
end
()
-
in_rows
.
begin
();
auto
in1_height
=
(
*
iter
)
->
height
();
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
());
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = [%d], second "
"input height = [%d]"
,
in1_height
,
input2
->
height
()));
}
// concat rows
std
::
vector
<
int64_t
>
in2_rows
;
...
...
@@ -201,13 +256,23 @@ struct SelectedRowsAddToTensor<platform::CPUDeviceContext, T> {
}
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
->
numel
()
/
in1_height
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
input2_data
=
input2
->
data
<
T
>
();
...
...
@@ -302,10 +367,12 @@ struct MergeAdd<platform::CPUDeviceContext, T> {
continue
;
}
PADDLE_ENFORCE_EQ
(
input_width
,
input
->
value
().
dims
()[
1
],
"all input should have same "
"dimension except for the first one"
);
platform
::
errors
::
InvalidArgument
(
"All inputs should have same "
"dimension except for the first one."
));
PADDLE_ENFORCE_EQ
(
input_height
,
input
->
height
(),
"all input should have same height"
);
platform
::
errors
::
InvalidArgument
(
"All inputs should have same height."
));
row_num
+=
input
->
rows
().
size
();
merged_row_set
.
insert
(
input
->
rows
().
begin
(),
input
->
rows
().
end
());
}
...
...
@@ -421,10 +488,12 @@ struct MergeAverage<platform::CPUDeviceContext, T> {
continue
;
}
PADDLE_ENFORCE_EQ
(
input_width
,
input
->
value
().
dims
()[
1
],
"all input should have same "
"dimension except for the first one"
);
platform
::
errors
::
InvalidArgument
(
"All inputs should have same "
"dimension except for the first one."
));
PADDLE_ENFORCE_EQ
(
input_height
,
input
->
height
(),
"all input should have same height"
);
platform
::
errors
::
InvalidArgument
(
"All input should have same height."
));
row_num
+=
input
->
rows
().
size
();
merged_row_set
.
insert
(
input
->
rows
().
begin
(),
input
->
rows
().
end
());
}
...
...
@@ -492,13 +561,23 @@ struct UpdateToTensor<platform::CPUDeviceContext, T> {
framework
::
Tensor
*
input2
)
{
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
->
numel
()
/
in1_height
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
input2_data
=
input2
->
data
<
T
>
();
...
...
paddle/fluid/operators/math/selected_rows_functor.cu
浏览文件 @
50e60e87
...
...
@@ -30,7 +30,12 @@ struct SelectedRowsAdd<platform::CUDADeviceContext, T> {
const
framework
::
SelectedRows
&
input2
,
framework
::
SelectedRows
*
output
)
{
auto
in1_height
=
input1
.
height
();
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
.
height
());
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
.
height
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
input2
.
height
()));
output
->
set_height
(
in1_height
);
framework
::
Vector
<
int64_t
>
in1_rows
(
input1
.
rows
());
...
...
@@ -48,18 +53,34 @@ struct SelectedRowsAdd<platform::CUDADeviceContext, T> {
auto
&
in2_value
=
input2
.
value
();
auto
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
());
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
());
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
in2_value
.
numel
()
/
in2_rows
.
size
()));
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
(),
platform
::
errors
::
InvalidArgument
(
"The input and oupput width must be equal."
"But recieved input width = [%d], output width = [%d]"
,
in1_row_numel
,
out_value
->
numel
()
/
out_rows
.
size
()));
auto
*
out_data
=
out_value
->
data
<
T
>
();
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
in1_place
=
input1
.
place
();
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in1_place
),
true
);
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in1_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the GPU place."
));
auto
in2_place
=
input2
.
place
();
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in2_place
),
true
);
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in2_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the GPU place."
));
auto
out_place
=
context
.
GetPlace
();
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
out_place
),
true
);
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
out_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the GPU place."
));
memory
::
Copy
(
BOOST_GET_CONST
(
platform
::
CUDAPlace
,
out_place
),
out_data
,
BOOST_GET_CONST
(
platform
::
CUDAPlace
,
in1_place
),
in1_data
,
...
...
@@ -104,15 +125,35 @@ struct SelectedRowsAddTensor<platform::CUDADeviceContext, T> {
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
.
dims
();
auto
out_dims
=
output
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
out_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = [%d], first input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
PADDLE_ENFORCE_EQ
(
in1_height
,
out_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The input and output height must be equal."
"But recieved input height = [%d], output height = [%d]"
,
in1_height
,
out_dims
[
0
]));
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
.
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
output
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
.
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
.
numel
()
/
in1_height
));
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
output
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The input and output width must be equal."
"But recieved input width = [%d], output width = [%d]"
,
in1_row_numel
,
output
->
numel
()
/
in1_height
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
in2_data
=
input2
.
data
<
T
>
();
...
...
@@ -148,7 +189,12 @@ struct SelectedRowsAddTo<platform::CUDADeviceContext, T> {
const
int64_t
input2_offset
,
framework
::
SelectedRows
*
input2
)
{
auto
in1_height
=
input1
.
height
();
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
());
PADDLE_ENFORCE_EQ
(
in1_height
,
input2
->
height
(),
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
input2
->
height
()));
auto
&
in1_rows
=
input1
.
rows
();
auto
&
in2_rows
=
*
(
input2
->
mutable_rows
());
...
...
@@ -162,9 +208,13 @@ struct SelectedRowsAddTo<platform::CUDADeviceContext, T> {
}
auto
in1_place
=
input1
.
place
();
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in1_place
),
true
);
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in1_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the GPU place."
));
auto
in2_place
=
input2
->
place
();
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in2_place
),
true
);
PADDLE_ENFORCE_EQ
(
platform
::
is_gpu_place
(
in1_place
),
true
,
platform
::
errors
::
InvalidArgument
(
"The running enviroment is not on the GPU place."
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
in2_data
=
in2_value
->
data
<
T
>
();
...
...
@@ -209,13 +259,23 @@ struct SelectedRowsAddToTensor<platform::CUDADeviceContext, T> {
framework
::
Tensor
*
input2
)
{
auto
in1_height
=
input1
.
height
();
auto
in2_dims
=
input2
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
auto
&
in1_value
=
input1
.
value
();
auto
&
in1_rows
=
input1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
->
numel
()
/
in1_height
));
auto
*
in1_data
=
in1_value
.
data
<
T
>
();
auto
*
in2_data
=
input2
->
data
<
T
>
();
...
...
@@ -340,10 +400,12 @@ struct MergeAdd<platform::CUDADeviceContext, T> {
continue
;
}
PADDLE_ENFORCE_EQ
(
input_width
,
input
->
value
().
dims
()[
1
],
"all input should have same "
"dimension except for the first one"
);
platform
::
errors
::
InvalidArgument
(
"All input should have same "
"dimension except for the first one."
));
PADDLE_ENFORCE_EQ
(
input_height
,
input
->
height
(),
"all input should have same height"
);
platform
::
errors
::
InvalidArgument
(
"All input should have same height."
));
merged_row_set
.
insert
(
input
->
rows
().
begin
(),
input
->
rows
().
end
());
}
std
::
vector
<
int64_t
>
merge_rows_cpu
(
merged_row_set
.
begin
(),
...
...
@@ -448,13 +510,23 @@ struct UpdateToTensor<platform::CUDADeviceContext, T> {
auto
in1_height
=
merged_in1
.
height
();
auto
in2_dims
=
input2
->
dims
();
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
]);
PADDLE_ENFORCE_EQ
(
in1_height
,
in2_dims
[
0
],
platform
::
errors
::
InvalidArgument
(
"The two inputs height must be equal."
"But recieved first input height = "
"[%d], second input height = [%d]"
,
in1_height
,
in2_dims
[
0
]));
auto
&
in1_value
=
merged_in1
.
value
();
auto
&
in1_rows
=
merged_in1
.
rows
();
int64_t
in1_row_numel
=
in1_value
.
numel
()
/
in1_rows
.
size
();
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
);
PADDLE_ENFORCE_EQ
(
in1_row_numel
,
input2
->
numel
()
/
in1_height
,
platform
::
errors
::
InvalidArgument
(
"The two inputs width must be equal."
"But recieved first input width = [%d], second input width = [%d]"
,
in1_row_numel
,
input2
->
numel
()
/
in1_height
));
auto
*
in1_data
=
in1_value
.
template
data
<
T
>();
auto
*
in2_data
=
input2
->
data
<
T
>
();
...
...
paddle/fluid/operators/math/selected_rows_functor_test.cu.cc
浏览文件 @
50e60e87
...
...
@@ -38,7 +38,9 @@ TEST(selected_rows_functor, gpu_add) {
{
static_cast
<
int64_t
>
(
rows1
.
size
()),
row_numel
}),
gpu_place
);
functor
(
ctx
,
in1_value
,
1.0
);
PADDLE_ENFORCE
(
cudaDeviceSynchronize
());
PADDLE_ENFORCE_EQ
(
cudaDeviceSynchronize
(),
0
,
paddle
::
platform
::
errors
::
PreconditionNotMet
(
"The all synchronization on the cuda is error!"
));
std
::
vector
<
int64_t
>
rows2
{
0
,
5
,
7
,
9
};
std
::
unique_ptr
<
paddle
::
framework
::
SelectedRows
>
selected_rows2
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录