Skip to content

Commit 5b9716d

Browse files
committed
add dims check
1 parent 4cd504d commit 5b9716d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

paddle/fluid/operators/sampling_id_op.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class SamplingIdOp : public framework::OperatorWithKernel {
3030
"Output(Out) of SamplingIdOp should not be null.");
3131

3232
auto input_dims = ctx->GetInputDim("X");
33+
PADDLE_ENFORCE(input_dims.size() == 2,
34+
"Input(X, Filter) should be 2-D tensor.");
3335

3436
framework::DDim dims = input_dims;
3537
ctx->SetOutputDim("Out", dims);
@@ -46,10 +48,8 @@ class SamplingIdOpMaker : public framework::OpProtoAndCheckerMaker {
4648
AddOutput("Out", "SamplingId data tensor.");
4749
AddComment(R"DOC(
4850
SamplingId Operator.
49-
@brief A layer for sampling id from multinomial distribution from the
50-
input layer. Sampling one id for one sample. The result is stored in
51-
output_.ids.
52-
)DOC");
51+
A layer for sampling id from multinomial distribution from the
52+
input layer. Sampling one id for one sample.)DOC");
5353
}
5454
};
5555
} // namespace operators

0 commit comments

Comments
 (0)