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.
1 parent edacb62 commit 24ba5eeCopy full SHA for 24ba5ee
paddle/fluid/operators/softmax_with_cross_entropy_op.cu
@@ -268,6 +268,10 @@ struct HardLabelSoftmaxWithCrossEntropyFunctor {
268
int64_t idx_remain = idx % remain;
269
// labels, loss view as [n, remain]
270
int64_t idx_lbl = idx_n * remain + idx_remain;
271
+ PADDLE_ENFORCE(labels_[idx_lbl] >= 0 && labels_[idx_lbl] < d_,
272
+ "The value of label[%ld] expected >= 0 and < %ld,"
273
+ "but got %ld. Please check input value.",
274
+ idx_lbl, d_, labels_[idx_lbl]);
275
// It also would ignore labels not in range(class_num).
276
if (idx_axis != labels_[idx_lbl]) {
277
log_softmax_[idx] = exp_on_device(log_softmax_[idx]);
0 commit comments