Skip to content

Commit df7a266

Browse files
committed
fix adam op for selected rows
1 parent b756063 commit df7a266

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

paddle/fluid/operators/adam_op.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,12 @@ class AdamOp : public framework::OperatorWithKernel {
5656
"Beta2 power accumulator should have 1 dimension");
5757

5858
auto param_dims = ctx->GetInputDim("Param");
59-
PADDLE_ENFORCE_EQ(
60-
param_dims, ctx->GetInputDim("Grad"),
61-
"Param and Grad input of AdamOp should have same dimension");
59+
if (ctx->GetInputsVarType("Grad")[0] ==
60+
framework::proto::VarType::LOD_TENSOR) {
61+
PADDLE_ENFORCE_EQ(
62+
param_dims, ctx->GetInputDim("Grad"),
63+
"Param and Grad input of AdamOp should have same dimension");
64+
}
6265
PADDLE_ENFORCE_EQ(
6366
param_dims, ctx->GetInputDim("Moment1"),
6467
"Param and Moment1 input of AdamOp should have same dimension");

0 commit comments

Comments
 (0)