That’s really helped! … Thank you a lot, but can you tell me how output and targets did not match in type although both of them is float and how can i avoid it again because i believe that part of this issue happened while importing my dataset using dataloader.
this is the class for importing my dataframe:
class My_dataset(Dataset):
def __init__(self, csv_path):
    self.data_info = pd.read_csv(csv_path,header=None)
    self.data = np.asarray(self.data_info.iloc[:,1:7], dtype=np.float64)
    self.label = np.asarray(self.data_info.iloc[:,7])
    self.data_len = len(self.data_info.index)
    
def __getitem__(self, index):
    single_row = self.data[index]
    row = torch.FloatTensor(single_row)
    target = torch.from_numpy(np.array(self.label[index]) )
    return (row, target)
def __len__(self):
    return self.data_len

and here’s a snippet of the main function while iterating over my_dataset:
for data, target in train_loader:
    target = target.float()
    target = target.unsqueeze_(0)
    data = Variable(data.permute(1, 0)).contiguous()
    target = Variable(target.permute(1,0))

where do you think this error aroused from?