Parsing CSV into Pytorch tensors
Try converting it to an array first:
test_tensor = torch.Tensor(test.values)
I think you're just missing .values
import torch
import pandas as pd
train = pd.read_csv('train.csv')
train_tensor = torch.tensor(train.values)
Only using NumPy
import numpy as np
import torch
tensor = torch.from_numpy(
np.genfromtxt("train.csv", delimiter=",")
)
Newer version of pandas highly recommend to use to_numpy
instead of values
train_tensor = torch.tensor(train.to_numpy())