We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents a78a60c + 0fca578 commit 929fb85Copy full SHA for 929fb85
paddle/fluid/operators/top_k_op.cc
@@ -34,8 +34,11 @@ class TopkOp : public framework::OperatorWithKernel {
34
35
PADDLE_ENFORCE_GE(k, 1, "k must >= 1");
36
PADDLE_ENFORCE_GE(input_dims.size(), 1, "input must have >= 1d shape");
37
- PADDLE_ENFORCE_GE(input_dims[input_dims.size() - 1], k,
38
- "input must have >= k columns");
+
+ if (ctx->IsRuntime()) {
39
+ PADDLE_ENFORCE_GE(input_dims[input_dims.size() - 1], k,
40
+ "input must have >= k columns");
41
+ }
42
43
framework::DDim dims = input_dims;
44
dims[dims.size() - 1] = k;
0 commit comments