I have Non Linear Regression Model ANN( X = [1000,3] , Y = [1000,8] )
with One hidden Layer(Nh = 6)
.
How add Validation and Test analisys in my Non Linear Regression ANN with Pytorch in my case?

Add code for split

Add code for test and validation in “epoch” loop
Model :
` ```
x = torch.from_numpy(x).float()
y = torch.from_numpy(y).float()
N, D_in, H, D_out = x.shape[0], x.shape[1], 6, y.shape[1]
model = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(D_in, H)),
#('Sig', nn.Sigmoid()),
('ISRU', ISRU()), # Add ISRU
('fc2', nn.Linear(H, D_out))]))
# Error 
loss_fn = torch.nn.L1Loss(reduction='mean')
# Train 
optimizer = torch.optim.Adam(model.parameters(), lr=1,eps=2**(EPS))
epoch = 250
for t in range(epoch):
# Forward pass: compute predicted y by passing x to the model.
clear_output(wait=True)
y_pred = model(X)
# Compute and print loss.
loss = loss_fn(y_pred, Y)
if t % 100 == 99:
print(t, loss.item())
optimizer.zero_grad() ;
loss.backward() ;
optimizer.step() ;
if loss.item() < diff : lista = np.vstack((lista, [loss.item(),2,EPS])) ; diff = loss.item()