Today, when I was trying to deal with my own dataset with one-hot label, something strange happened. My snippet is like this:
`class LCZDataset(data.Dataset):
def init(self,path):
self.path = path
self.file = h5py.File(self.path)
self.sen1 = self.file[‘sen1’]
self.sen2 = self.file[“sen2”]
self.label = self.file[“label”]
def __getitem__(self,index):
    index_sen1 = torch.tensor(np.array(self.sen1[index])).permute(2,0,1)
    index_sen2 = torch.tensor(np.array(self.sen2[index])).permute(2,0,1)
    
    label = int(np.argwhere(self.label[index]==1))
   
    sen_tensor = torch.cat((index_sen1,index_sen2),0)  
    
    return sen_tensor,label 

def __len__(self):
    return self.sen1.shape[0] `

Then, it errors " only size-1 arrays can be converted to Python scalars". I tried to print the self.label[index], and it printed out . However, the label of my dataset is absolutely in one-hot form. Have any one of you meet the  same problem? Do you know why? Thank you.