It triggers this error on my system:
device = 'cuda'
loss = nn.CrossEntropyLoss().to(device)
input = torch.randn(3, 2, requires_grad=True)
target = torch.empty(3, dtype=torch.long).random_(15)
output = loss(input, target)
> IndexError: Target 13 is out of bounds.