0

I have 4 text files,one of which includes x1,x2,x3 as training features and the other one is y for labels and the same applies to testing.
I have to construct a Multi Layer Perceptron (MLP) model in Pytorch and what I did was to load these text files to PyTorch under the names of x_train,y_train,x_test and y_test.
However when I run the code below:

dataset_train = data.TensorDataset(x_train,y_train)
dataloader_train =data.DataLoader(dataset_train, batch_size=10, shuffle=True,num_workers=0)

I get this error :

'numpy.int64' object is not callable

I also see this : Size mismatch between tensors.
please help me with this error,what does it mean and what I have to change ?

Hossein
  • 24,202
  • 35
  • 119
  • 224
  • so I tried to convert them to tensors but nothing changed using these codes : '''tensor_ = torch.from_numpy(x_train.to_numpy().astype(np.int64))''' – sepideh naghshineh Apr 05 '22 at 12:04
  • Have you checked the size of all tensors? They should be same. – Abhibha Gupta Apr 05 '22 at 13:58
  • Hi, welcome to stackoverflow, please provide a Minimal Reproducible Example so we can help you better. Also currently this is too vague you need to add more details as well otherwise you might get down-voted and get your question closed – Hossein Apr 05 '22 at 14:11

0 Answers0