Trying to run the following code:
weights = np.array([0.05, 0.71, 0.21, 0.02, 0.01])
weights = mx.nd.array(weights)
loss_function = gluon.loss.SoftmaxCELoss()
with mx.autograd.record():
outputs = [net(data_slice) for data_slice in data]
losses = [loss_function(o, l, weights) for o, l in zip(outputs, labels)]
leads to the following error:
TypeError: type <class 'mxnet.ndarray.ndarray.NDArray'> not supported
Any idea, what is wrong here?
I tried already with simple numpy arrays:
weights = np.array([0.05, 0.71, 0.21, 0.02, 0.01])
without casting it into a mx.nd.array, but I then get the following error:
TypeError: type <class 'numpy.ndarray'> not supported
Which kind of type should I use?
The documentation online doesn’t specify any type for the class_weight parameter.
Thx