code: def fit(model, loss, opt, x, y):
      # Declares initial variables
      x = Variable(x, requires_grad=False)
      y = Variable(y, requires_grad=False)
  
      # Resetting the gradient
      opt.zero_grad()
  
      # Performs the foward pass
      fw_x = model.forward(x)
      output = loss.forward(fw_x, y)
  
      # Performs backward pass
      output.backward()
  
      # Updates parameters
      opt.step()
  
      return output.item()
  
file_path: opytimizer/examples/integrations/pytorch/cnn.py
imports: import numpy
  import torch
  from sklearn.datasets import load_digits
  from sklearn.model_selection import train_test_split
  from torch import optim
  from torch.autograd import Variable
  from opytimizer import Opytimizer
  from opytimizer.core import Function
  from opytimizer.optimizers.swarm import PSO
  from opytimizer.spaces import SearchSpace
label_desc: Use image node_id 1 for calling a global function with example usage: fit(model, loss, opt, x, y) and returns: output