提交 d9f0e725 编写于 作者: L luotao1

refine with comments

test=develop
上级 6fa52f83
...@@ -119,11 +119,8 @@ void FCOpMaker::Make() { ...@@ -119,11 +119,8 @@ void FCOpMaker::Make() {
AddAttr<bool>("use_mkldnn", AddAttr<bool>("use_mkldnn",
"(bool, default false) Only used in mkldnn kernel") "(bool, default false) Only used in mkldnn kernel")
.SetDefault(false); .SetDefault(false);
AddAttr<bool>( AddAttr<bool>(framework::kAllKernelsMustComputeRuntimeShape,
framework::kAllKernelsMustComputeRuntimeShape, "Skip calling InferShape() function in the runtime.")
"If an Op has this attribute, all its kernels should calculate output"
"variable's shape in the corresponding Compute() function. Note that "
"this temporal attribute would be deleted after all ops contain it.")
.SetDefault(true); .SetDefault(true);
AddComment(R"DOC( AddComment(R"DOC(
Fully Connected Operator. Fully Connected Operator.
...@@ -140,8 +137,8 @@ class FCOpKernel : public framework::OpKernel<T> { ...@@ -140,8 +137,8 @@ class FCOpKernel : public framework::OpKernel<T> {
PADDLE_ENFORCE(platform::is_cpu_place(ctx.GetPlace()), PADDLE_ENFORCE(platform::is_cpu_place(ctx.GetPlace()),
"It must use CPUPlace."); "It must use CPUPlace.");
auto input = ctx.Input<framework::LoDTensor>("Input"); auto input = ctx.Input<framework::LoDTensor>("Input");
auto w = ctx.Input<framework::LoDTensor>("W"); auto w = ctx.Input<Tensor>("W");
auto bias = ctx.Input<framework::LoDTensor>("Bias"); auto bias = ctx.Input<Tensor>("Bias");
auto output = ctx.Output<framework::LoDTensor>("Out"); auto output = ctx.Output<framework::LoDTensor>("Out");
int in_num_col_dims = ctx.Attr<int>("in_num_col_dims"); int in_num_col_dims = ctx.Attr<int>("in_num_col_dims");
auto w_dims = w->dims(); auto w_dims = w->dims();
......
...@@ -88,11 +88,8 @@ class FusedEmbeddingSeqPoolOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -88,11 +88,8 @@ class FusedEmbeddingSeqPoolOpMaker : public framework::OpProtoAndCheckerMaker {
"(boolean, default false) " "(boolean, default false) "
"Sparse update.") "Sparse update.")
.SetDefault(false); .SetDefault(false);
AddAttr<bool>( AddAttr<bool>(framework::kAllKernelsMustComputeRuntimeShape,
framework::kAllKernelsMustComputeRuntimeShape, "Skip calling InferShape() function in the runtime.")
"If an Op has this attribute, all its kernels should calculate output"
"variable's shape in the corresponding Compute() function. Note that "
"this temporal attribute would be deleted after all ops contain it.")
.SetDefault(true); .SetDefault(true);
AddComment(R"DOC( AddComment(R"DOC(
FusedEmbeddingSeqPool Operator. FusedEmbeddingSeqPool Operator.
......
...@@ -54,11 +54,8 @@ $$Out = scale * X$$ ...@@ -54,11 +54,8 @@ $$Out = scale * X$$
)DOC"); )DOC");
AddAttr<int>("num_hash", "").SetDefault(1); AddAttr<int>("num_hash", "").SetDefault(1);
AddAttr<int>("mod_by", "").SetDefault(100000); AddAttr<int>("mod_by", "").SetDefault(100000);
AddAttr<bool>( AddAttr<bool>(framework::kAllKernelsMustComputeRuntimeShape,
framework::kAllKernelsMustComputeRuntimeShape, "Skip calling InferShape() function in the runtime.")
"If an Op has this attribute, all its kernels should calculate output"
"variable's shape in the corresponding Compute() function. Note that "
"this temporal attribute would be deleted after all ops contain it.")
.SetDefault(true); .SetDefault(true);
} }
}; };
......
...@@ -124,8 +124,8 @@ class FCMKLDNNOpKernel : public paddle::framework::OpKernel<T> { ...@@ -124,8 +124,8 @@ class FCMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
const auto& mkldnn_engine = dev_ctx.GetEngine(); const auto& mkldnn_engine = dev_ctx.GetEngine();
auto input = ctx.Input<framework::LoDTensor>("Input"); auto input = ctx.Input<framework::LoDTensor>("Input");
auto w = ctx.Input<framework::LoDTensor>("W"); auto w = ctx.Input<Tensor>("W");
auto bias = ctx.Input<framework::LoDTensor>("Bias"); auto bias = ctx.Input<Tensor>("Bias");
PADDLE_ENFORCE(input->dims().size() == 2 || input->dims().size() == 4, PADDLE_ENFORCE(input->dims().size() == 2 || input->dims().size() == 4,
"Input must be with 2 or 4 dimensions, i.e. NCHW"); "Input must be with 2 or 4 dimensions, i.e. NCHW");
......
...@@ -59,11 +59,8 @@ class SequenceEnumerateOpMaker : public framework::OpProtoAndCheckerMaker { ...@@ -59,11 +59,8 @@ class SequenceEnumerateOpMaker : public framework::OpProtoAndCheckerMaker {
}); });
AddAttr<int>("pad_value", "(int) The enumerate sequence padding value.") AddAttr<int>("pad_value", "(int) The enumerate sequence padding value.")
.SetDefault(0); .SetDefault(0);
AddAttr<bool>( AddAttr<bool>(framework::kAllKernelsMustComputeRuntimeShape,
framework::kAllKernelsMustComputeRuntimeShape, "Skip calling InferShape() function in the runtime.")
"If an Op has this attribute, all its kernels should calculate output"
"variable's shape in the corresponding Compute() function. Note that "
"this temporal attribute would be deleted after all ops contain it.")
.SetDefault(true); .SetDefault(true);
AddComment(R"DOC( AddComment(R"DOC(
Sequence Enumerate Operator. Sequence Enumerate Operator.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册