Describe the bug
Tried to train PSPNet with class weights [0.052, 9.23].
When calculating cross entropy loss, it tries to create a tensor from list of the tensor where PyTorch throws an error.
[/content/mmsegmentation/mmseg/models/losses/cross_entropy_loss.py](https://ra7s57vsu1g-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab_20231024-060124_RC00_576097381#) in cross_entropy(pred, label, weight, class_weight, reduction, avg_factor, ignore_index, avg_non_ignore)
64 else:
65 # the average factor should take the class weights into account
---> 66 label_weights = torch.tensor([class_weight[cls] for cls in label],
67 device=class_weight.device)
68 if avg_non_ignore:
ValueError: only one element tensors can be converted to Python scalars
If I remove the class weights, it doesn't produce the error.
Describe the bug
Tried to train PSPNet with class weights [0.052, 9.23].
When calculating cross entropy loss, it tries to create a tensor from list of the tensor where PyTorch throws an error.
If I remove the class weights, it doesn't produce the error.