diff --git a/paddle/operators/accuracy_op.cc b/paddle/operators/accuracy_op.cc index 32479ae5a3..391258b40b 100644 --- a/paddle/operators/accuracy_op.cc +++ b/paddle/operators/accuracy_op.cc @@ -55,15 +55,15 @@ class AccuracyOpMaker : public framework::OpProtoAndCheckerMaker { // TODO(typhoonzero): AddInput("Weight", ... AddOutput("Accuracy", "The accuracy of current batch"); - AddComment( - R"DOC(Accuracy. It will print accuracy rate for classification. + AddComment(R"DOC( +Accuracy. It will print accuracy rate for classification. The accuracy is: .. math:: accuracy = \\frac{NumOfCorrectPredicts}{NumOfAllSamples}) Both the input `Inference` and `Label` can carry the LoD (Level of Details) information, or not. But the output only shares the LoD with input `Inference`. -DOC"); +)DOC"); } }; diff --git a/paddle/operators/dropout_op.cc b/paddle/operators/dropout_op.cc index b111b9fccb..bfa1992d79 100644 --- a/paddle/operators/dropout_op.cc +++ b/paddle/operators/dropout_op.cc @@ -38,6 +38,7 @@ class DropoutOp : public framework::OperatorWithKernel { if (ctx.Attr("is_training") == 1) { ctx.Output("Mask")->Resize(dims); } + ctx.ShareLoD("X", "Out"); } }; diff --git a/paddle/operators/fc_op.cc b/paddle/operators/fc_op.cc index 56fe654d1e..5ac0e8cc45 100644 --- a/paddle/operators/fc_op.cc +++ b/paddle/operators/fc_op.cc @@ -189,7 +189,6 @@ Activation type can be set to `identity` (default), `sigmoid` or `softmax`. All the inputs can carry the LoD (Level of Details) information, or not. But the output only shares the LoD with first input (`X[0]`). -)DOC"); )DOC"); } }; diff --git a/paddle/operators/pad_op.cc b/paddle/operators/pad_op.cc index a0b1c6b631..98de18fb9f 100644 --- a/paddle/operators/pad_op.cc +++ b/paddle/operators/pad_op.cc @@ -41,6 +41,11 @@ class PadOp : public framework::OperatorWithKernel { } ctx.Output("Out")->Resize( framework::make_ddim(out_dims)); + if (out_dims[0] == x_dim[0]) { + // Only pass LoD when the first dimension is equal between + // output and input. + ctx.ShareLoD("X", "Out"); + } } }; diff --git a/paddle/operators/reshape_op.cc b/paddle/operators/reshape_op.cc index 0d05e34414..c090758619 100644 --- a/paddle/operators/reshape_op.cc +++ b/paddle/operators/reshape_op.cc @@ -51,6 +51,11 @@ class ReshapeOp : public framework::OperatorWithKernel { [](int a) { return static_cast(a); }); auto out_dims = framework::make_ddim(shape_int64); ctx.Output("Out")->Resize(out_dims); + if (shape[0] == in->dims()[0]) { + // Only pass LoD when the first dimension is equal between + // output and input. + ctx.ShareLoD("X", "Out"); + } } };