Hello Team,
i am new to the forum and to Pytorch, i want to predict 3 real values Y1, Y2 & Y3 from input values X1, X2…X10 using the below model, but i get the error in title:
File “/home/abdelmoula/anaconda3/lib/python3.6/site-packages/torch/nn/functional.py”, line 833, in linear
if input.dim() == 2 and bias is not None:
AttributeError: ‘numpy.ndarray’ object has no attribute ‘dim’
Can you please on what is wrong ? thank you
########################
MODEL:
import pandas as pd
import torch
from torch.autograd import Variable
dataset = pd.read_csv(‘Welding.csv’)
dataset_test = pd.read_csv(‘Welding_test.csv’)
x=dataset.iloc[:,:-3].values
y=dataset.iloc[:,-3:].values
x_test=dataset.iloc[:,:].values
model = torch.nn.Sequential(
torch.nn.Linear(10, 20),
torch.nn.ReLU(),
torch.nn.Linear(20, 3),
)
loss_fn = torch.nn.MSELoss(size_average=False)
learning_rate = 1e-2
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)
for t in range(5000):
y_pred = model(x)
loss = loss_fn(y_pred, y)
print(t, loss.data[0])
optimizer.zero_grad()
loss.backward()
optimizer.step()

print (model(x_test))