Solved by ptrblck in post #2 
              
              
                label.view(-1, 1).long() contains invalid indices for the scatter_ operation. 
Since one_hot has the shape [32, 1108], and you are trying to scatter into dim1, label should be clamped at [0, 1108]: 
label = label.clamp(0, 1108)
one_hot.scatter_(1, label.view(-1, 1).long(), 1)