Skip to content

Commit 613d3ef

Browse files
committed
Fix compile error
1 parent a0c4138 commit 613d3ef

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

paddle/fluid/operators/batch_size_like.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BatchSizeLikeOp : public framework::OperatorWithKernel {
5353

5454
class BatchSizeLikeOpMaker : public framework::OpProtoAndCheckerMaker {
5555
public:
56-
void Make() override {
56+
void Make() final {
5757
AddInput("Input",
5858
"(Tensor) Tensor "
5959
"whose input_dim_idx'th dimension specifies the batch_size");
@@ -67,7 +67,11 @@ class BatchSizeLikeOpMaker : public framework::OpProtoAndCheckerMaker {
6767
AddAttr<int>("output_dim_idx",
6868
"(int, default 0) The index of output's batch size dimension")
6969
.SetDefault(0);
70+
Apply();
7071
}
72+
73+
protected:
74+
virtual void Apply() = 0;
7175
};
7276

7377
} // namespace operators

paddle/fluid/operators/fill_constant_batch_size_like_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class FillConstantBatchSizeLikeOp : public BatchSizeLikeOp {
3030
};
3131

3232
class FillConstantBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker {
33-
public:
34-
void Make() override {
33+
protected:
34+
void Apply() override {
3535
AddAttr<int>("dtype",
3636
"(int, default 5 (FP32)) "
3737
"Output data type")

paddle/fluid/operators/gaussian_random_batch_size_like_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class GaussianRandomBatchSizeLikeOp : public BatchSizeLikeOp {
3232
};
3333

3434
class GaussianRandomBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker {
35-
public:
36-
void Make() override {
35+
protected:
36+
void Apply() override {
3737
AddAttr<float>("mean",
3838
"(float, default 0.0) "
3939
"mean of random tensor.")

paddle/fluid/operators/uniform_random_batch_size_like_op.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class UniformRandomBatchSizeLikeOp : public BatchSizeLikeOp {
3232
};
3333

3434
class UniformRandomBatchSizeLikeOpMaker : public BatchSizeLikeOpMaker {
35-
public:
36-
void Make() override {
35+
protected:
36+
void Apply() override {
3737
AddComment(R"DOC(
3838
Uniform random operator
3939

python/paddle/fluid/layers/layer_function_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def generate_layer_fn(op_type):
113113

114114
if len(not_intermediate_outputs) != 1:
115115
raise ValueError("Only one non intermediate output operator can be",
116-
"automatically generated.")
116+
"automatically generated. {0}".format(op_type))
117117

118118
if not_intermediate_outputs[0].duplicable:
119119
raise ValueError(

0 commit comments

Comments
 (0)