I tried to insert in the back propagation the below, basically the idea was to replace (in bold) the idx (data, target) that is dimension ([4, 4]) with a label_inter, which is the same that is used in the dataset.
label_inter = pd.read_csv(data_dir+'train.csv').iloc[idx, 1:5].value
label_inter = torch.from_numpy(label_inter.astype(np.int64))
label_inter = label_inter.squeeze(-1)
label_inter = label_inter.view(-1)

But then I have an error

ValueError: Expected input batch_size (1) to match target batch_size (4)

after the Idx 455, but I checked and there is nothing specific on the picture Train_456.jpg
So this doesn’t work neither. Any suggestions? Why the dataloader change the dimension of my label?
Note the picture are categorized as below: