The problem comes from here:



 krishna511:

   def __getitem__(this, idx):
        if this.mode == "train":
            return torch.FloatTensor(this.X[idx]), torch.LongTensor(this.y[idx])
        else:
            return torch.FloatTensor(this.X[idx])



Please try to replace torch.FloatTensor(this.X[idx]) by torch.tensor(this.X[idx], dtype=torch.float) and replace torch.LongTensor(this.y[idx]) by torch.tensor(this.y[idx], dtype=torch.long)