Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
d003573f
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d003573f
编写于
9月 16, 2020
作者:
W
wawltor
提交者:
GitHub
9月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add the error message check for the some operator
add the error message check for the some operator
上级
389a9a7e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
39 addition
and
17 deletion
+39
-17
paddle/fluid/operators/arg_min_max_op_base.h
paddle/fluid/operators/arg_min_max_op_base.h
+13
-9
paddle/fluid/operators/assign_op.h
paddle/fluid/operators/assign_op.h
+4
-1
paddle/fluid/operators/isfinite_op.cc
paddle/fluid/operators/isfinite_op.cc
+5
-1
paddle/fluid/operators/isfinite_op.h
paddle/fluid/operators/isfinite_op.h
+5
-1
paddle/fluid/operators/linspace_op.cc
paddle/fluid/operators/linspace_op.cc
+0
-2
paddle/fluid/operators/linspace_op.cu
paddle/fluid/operators/linspace_op.cu
+4
-1
paddle/fluid/operators/linspace_op.h
paddle/fluid/operators/linspace_op.h
+4
-1
paddle/fluid/operators/scale_op.h
paddle/fluid/operators/scale_op.h
+4
-1
未找到文件。
paddle/fluid/operators/arg_min_max_op_base.h
浏览文件 @
d003573f
...
...
@@ -110,10 +110,12 @@ struct VisitDataArgMinMaxFunctor {
CALL_ARG_MINMAX_FUNCTOR
(
6
);
break
;
default:
PADDLE_THROW
(
"%s operator doesn't supports tensors whose ranks are greater "
"than 6."
,
(
EnumArgMinMaxValue
==
kArgMin
?
"argmin"
:
"argmax"
));
PADDLE_ENFORCE_LE
(
x_dims
.
size
(),
6
,
platform
::
errors
::
InvalidArgument
(
"%s operator doesn't supports tensors whose ranks are greater "
"than 6."
,
(
EnumArgMinMaxValue
==
kArgMin
?
"argmin"
:
"argmax"
)));
break
;
#undef CALL_ARG_MINMAX_FUNCTOR
}
...
...
@@ -164,7 +166,8 @@ class ArgMinMaxOp : public framework::OperatorWithKernel {
PADDLE_ENFORCE_LT
(
axis
,
x_dims
.
size
(),
platform
::
errors
::
InvalidArgument
(
"'axis'(%d) must be less than Rank(X)(%d)."
,
axis
,
x_dims
.
size
()));
"'axis'(%d) must be less than Rank(X)(%d) of Input(X)."
,
axis
,
x_dims
.
size
()));
const
int
&
dtype
=
ctx
->
Attrs
().
Get
<
int
>
(
"dtype"
);
PADDLE_ENFORCE_EQ
(
...
...
@@ -192,10 +195,11 @@ class ArgMinMaxOp : public framework::OperatorWithKernel {
}
PADDLE_ENFORCE_LE
(
all_element_num
,
INT_MAX
,
"The element num of the argmin/argmax input at axis is "
"%d, is larger than int32 maximum value:%d, you must "
"set the dtype of argmin/argmax to 'int64'."
,
all_element_num
,
INT_MAX
);
platform
::
errors
::
InvalidArgument
(
"The element num of the argmin/argmax input at axis is "
"%d, is larger than int32 maximum value:%d, you must "
"set the dtype of argmin/argmax to 'int64'."
,
all_element_num
,
INT_MAX
));
}
}
std
::
vector
<
int64_t
>
vec
;
...
...
paddle/fluid/operators/assign_op.h
浏览文件 @
d003573f
...
...
@@ -52,7 +52,10 @@ class AssignFunctor {
template
<
typename
T
>
void
operator
()(
const
T
&
v
)
const
{
PADDLE_THROW
(
"Not support type for assign op %s"
,
typeid
(
T
).
name
());
PADDLE_ENFORCE_EQ
(
true
,
false
,
platform
::
errors
::
PermissionDenied
(
"Not support type for assign op with type %s"
,
typeid
(
T
).
name
()));
}
private:
...
...
paddle/fluid/operators/isfinite_op.cc
浏览文件 @
d003573f
...
...
@@ -43,7 +43,11 @@ class OverflowOp : public framework::OperatorWithKernel {
}
else
if
(
x_var
->
IsType
<
framework
::
SelectedRows
>
())
{
dtype
=
x_var
->
Get
<
framework
::
SelectedRows
>
().
value
().
type
();
}
else
{
PADDLE_THROW
(
"Cannot find the input data type by all input data"
);
PADDLE_ENFORCE_EQ
(
true
,
false
,
platform
::
errors
::
InvalidArgument
(
"The input type mismatch, the type of Input(X) must be Tensor or "
"SelectedRows, please check your input."
));
}
return
framework
::
OpKernelType
(
framework
::
proto
::
VarType
::
Type
(
dtype
),
ctx
.
GetPlace
());
...
...
paddle/fluid/operators/isfinite_op.h
浏览文件 @
d003573f
...
...
@@ -57,7 +57,11 @@ class OverflowKernel : public framework::OpKernel<T> {
auto
&
in
=
ctx
.
Input
<
framework
::
SelectedRows
>
(
"X"
)
->
value
();
functor
(
in
,
out
);
}
else
{
PADDLE_THROW
(
"Unsupported input type."
);
PADDLE_ENFORCE_EQ
(
true
,
false
,
platform
::
errors
::
InvalidArgument
(
"The input type mismatch, the type of Input(X) must be Tensor or "
"SelectedRows, please check your input."
));
}
}
};
...
...
paddle/fluid/operators/linspace_op.cc
浏览文件 @
d003573f
...
...
@@ -22,8 +22,6 @@ class LinspaceOp : public framework::OperatorWithKernel {
using
framework
::
OperatorWithKernel
::
OperatorWithKernel
;
void
InferShape
(
framework
::
InferShapeContext
*
ctx
)
const
override
{
PADDLE_ENFORCE
(
ctx
->
HasInput
(
"Start"
),
"Input(Start) of LinspaceOp should not be null."
);
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"Start"
),
"Input"
,
"Start"
,
"linspace"
);
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"Stop"
),
"Input"
,
"Stop"
,
"linspace"
);
OP_INOUT_CHECK
(
ctx
->
HasInput
(
"Num"
),
"Input"
,
"Num"
,
"linspace"
);
...
...
paddle/fluid/operators/linspace_op.cu
浏览文件 @
d003573f
...
...
@@ -63,7 +63,10 @@ class CUDALinspaceKernel : public framework::OpKernel<T> {
framework
::
TensorCopy
(
*
num_t
,
platform
::
CPUPlace
(),
&
n
);
int32_t
num
=
n
.
data
<
int32_t
>
()[
0
];
PADDLE_ENFORCE
(
num
>
0
,
"The num of linspace op should be larger than 0."
);
PADDLE_ENFORCE_GT
(
num
,
0
,
platform
::
errors
::
InvalidArgument
(
"The num of linspace op should be larger "
"than 0, but received num is %d"
,
num
));
out
->
Resize
(
framework
::
make_ddim
({
num
}));
T
*
out_data
=
out
->
mutable_data
<
T
>
(
context
.
GetPlace
());
...
...
paddle/fluid/operators/linspace_op.h
浏览文件 @
d003573f
...
...
@@ -46,7 +46,10 @@ class CPULinspaceKernel : public framework::OpKernel<T> {
T
start
=
start_t
.
data
<
T
>
()[
0
];
T
stop
=
stop_t
.
data
<
T
>
()[
0
];
PADDLE_ENFORCE
(
num
>
0
,
"The num of linspace op should be larger than 0."
);
PADDLE_ENFORCE_GT
(
num
,
0
,
platform
::
errors
::
InvalidArgument
(
"The num of linspace op should be larger "
"than 0, but received num is %d"
,
num
));
out
->
Resize
(
framework
::
make_ddim
({
num
}));
...
...
paddle/fluid/operators/scale_op.h
浏览文件 @
d003573f
...
...
@@ -60,7 +60,10 @@ class ScaleKernel : public framework::OpKernel<T> {
out
->
mutable_data
<
T
>
(
in
->
place
());
PADDLE_ENFORCE_EQ
(
in
->
dims
(),
out
->
dims
(),
"in and out should have the same dim"
);
paddle
::
platform
::
errors
::
InvalidArgument
(
"the input and output should have the same dim"
"but input dim is %s, output dim is %s"
,
in
->
dims
(),
out
->
dims
()));
auto
eigen_out
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
out
);
auto
eigen_in
=
framework
::
EigenVector
<
T
>::
Flatten
(
*
in
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录