krishna511:

sir my Y_train shape is (3441,), is this the problem?


This shouldn’t be a problem, since my code snippet uses the same shape for y_train as well as your Dataset definition.



 krishna511:

then I got an error in line:
return torch.FloatTensor(this.X[idx]), torch.LongTensor(this.y[idx])


numpy uses float64 by default, so you might want to transform the tensor to float32 via:
X_test = torch.from_numpy(X_test).float()




 krishna511:

Sir plz tell me if I need to share the model also. I think the whole problem is in loading the dataset .


A minimal and executable code snippet would be helpful to further debug the issue.