Incubator-mxnet: InferShape Error in softmax's label argument

Created on 9 Dec 2015  路  5Comments  路  Source: apache/incubator-mxnet

This is the structure of my network:
......
cccp6 = mx.symbol.Convolution(data=relu_cccp5, kernel=(1, 1), stride=(1, 1), num_filter=num_classes)
# stage 4
softmax = mx.symbol.SoftmaxOutput(data=cccp6, name='softmax',multi_output=True)

However,when I begin to train my model, I meet such an error:

mxnet.base.MXNetError: InferShape Error in softmax's label argument
Corresponding keyword of symbol: softmax_label
Shape inconsistent, Provided =(128,), inferred shape=(128,1)

What should I do to solve it?

On the other hand, if I set multi_output=False, although this problem disappear, another problem come here:

/mshadow/mshadow/././cuda/tensor_gpu-inl.cuh:281: Check failed: (dst.size(0)) == (label.size(0)) SoftmaxGrad: label shape mismatch (my batch_size=128,so dst.size(0)=256, label.size(0)=128)

Most helpful comment

I got the same problem. I set the data with label_width=2,,, however, when I train the net, got the message: mxnet.base.MXNetError: InferShape Error in softmax's label argument
Corresponding keyword of symbol: softmax_label
Shape inconsistent, Provided =(192,2), inferred shape=(192,1)

All 5 comments

What's the shape of your label tensor?

Why do you want multi_output=True if you only have one output?

I got the same problem. I set the data with label_width=2,,, however, when I train the net, got the message: mxnet.base.MXNetError: InferShape Error in softmax's label argument
Corresponding keyword of symbol: softmax_label
Shape inconsistent, Provided =(192,2), inferred shape=(192,1)

How should I set the inferred shape, the same to the input shape?

Closing for now due to inactivity.

Was this page helpful?
0 / 5 - 0 ratings