code: def valid_step(model, iterator, device, criterion, batch_size):
      model.eval()
      y_preds = []
      losses = []
      batch_sizes = []
      tic = time.time()
      with torch.no_grad():
          for Xi, yi in iterator:
              Xi, yi = to_device(Xi, device), to_device(yi, device)
              y_pred = model(Xi)
              y_pred = torch.log(y_pred)
              loss = criterion(y_pred, yi)
  
              y_preds.append(y_pred)
              loss = loss.item()
              losses.append(loss)
              batch_sizes.append(len(Xi))
      toc = time.time()
      return {
          "losses": losses,
          "batch_sizes": batch_sizes,
          "y_proba": torch.cat(y_preds).cpu().detach().numpy(),
          "time": toc - tic,
      }
  
imports: import argparse
  import time
  import numpy
  from sklearn.datasets import fetch_openml
  from sklearn.model_selection import train_test_split
  from sklearn.model_selection import StratifiedKFold
  from sklearn.metrics import accuracy_score
  from sklearn.utils import shuffle
  import torch
  from torch import nn
  from skorch.utils import to_device
  from skorch import NeuralNetClassifier
  from skorch.callbacks import EpochScoring
label_desc: Use image node_id 6 for calling a global function with example usage: valid_step(model, iterator, device, criterion, batch_size) and returns: dict