Matrix_op-inl.h:670: Check failed: b < len

It looks like I’m hitting this condition: https://github.com/apache/incubator-mxnet/blob/master/src/operator/tensor/matrix_op-inl.h#L670

Should that ever happen or does that indicate a bug in mxnet? It’s happening consistently but I haven’t narrowed it down to a small test case.

It is a little suspicious that line 664 uses CHECK_GE but line 670 uses CHECK_LT and not CHECK_LE

Here’s the full error message: mxnet.base.MXNetError: [15:30:34] src/operator/tensor/./matrix_op-inl.h:670: Check failed: b < len (21 vs. 21) slicing with begin[0]=21 exceends limit of 21

the use of CHECK_GE versus CHECK_LT seem consistent to me since we’re using zero indexing.

In what contexts are you getting this error message? It looks like you’re trying to perform a slice operation where your interval endpoint is bigger than your greatest index. Could you provide more info about the code you’re running?

I get this error whenever I try to copy data from this matrix to cpu to use it (by calling asnumpy, or asscalar, or trying to print it). It’s the output of gluon.loss.SoftmaxCrossEntropyLoss for a batch of 99 vectors.


Has the issue been resolved for you? I got the same error when i want to print or slice the output of network,then i found not only the output of network cannot be printed or sliced.I made a ndarray and it cannot be printed, either.however, when i move the code to a empty .py file to reproduce this error ,it works well. could you please tell me how you fixed it ? thanks .

I know the reason, when assign the input of network , the slice oversteps the boundary,like this :
x = nd.ones((1, 1, 700, 512))
x[1,:,:500,:303] = 50
output = net(x)
which shuold be :
x = nd.ones((1, 1, 700, 512))
x[0,:,:500,:303] = 50
output = net(x)
but the mxnet doesn’t report this error. the input is wrong,so every feature map of network is wrong.
Hopes helpful !