Yolkandwhite:

IndexError: Target 255 is out of bounds.


This error occurs when using inappropriate targets:
>>> import torch
>>> loss_fn = torch.nn.CrossEntropyLoss()
>>> input = torch.randn(3, 2, 24, 24)
>>> target = torch.empty(3, 24, 24, dtype=torch.long).random_(2) * 255
>>> loss = loss_fn(input, target)
IndexError: Target 255 is out of bounds.