title: How to add a Validation and Test Set in Pytorch Model?
body: <p>I have Non Linear Regression <code>Model ANN( X = [1000,3] , Y = [1000,8] )</code> with One hidden <code>Layer(Nh = 6)</code>. </p>
  
  <p>How to add a Validation(10% Dataset) and Test Set(10% Dataset) in this model ?</p>
  
  <p><strong>Model :</strong></p>
  
  <pre><code>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() &lt; diff : lista = np.vstack((lista, [loss.item(),2,EPS])) ; diff = loss.item()
  </code></pre>