I tried to isolate the code snippet, which might cause the issue, but this works fine:

for i in range(0, 20):
    label_vector = torch.ones(80, dtype=torch.int64).to(device)
    label_vector = label_vector*i
    z_in = torch.randn(len(label_vector), 100).to(device)                
    label = label_vector
    
    label_oh = label.new(label.size(0), 100).float().zero_()
    label = label.unsqueeze(1)
    label_oh.scatter_(1, label, 1)

Note that your Dataset returns label, image while you are using inputs, coards_labels in your DataLoader loop.
I don’t know, if this mismatch might be related to your issue, but feel free to post a code snippet to reproduce this issue in case you get stuck.
PS: You can post code snippets by wrapping them into three backticks ```, which makes debugging easier.