code: def execute_steps(
      func,
      initial_state,
      optimizer_class,
      optimizer_config,
      num_iter=500,
  ):
      x = torch.Tensor(initial_state).requires_grad_(True)
      optimizer = optimizer_class([x], **optimizer_config)
      steps = []
      steps = np.zeros((2, num_iter + 1))
      steps[:, 0] = np.array(initial_state)
      for i in range(1, num_iter + 1):
          optimizer.zero_grad()
          f = func(x)
          f.backward(create_graph=True, retain_graph=True)
          torch.nn.utils.clip_grad_norm_(x, 1.0)
          optimizer.step()
          steps[:, i] = x.detach().numpy()
      return steps
  
file_path: pytorch-optimizer/examples/viz_optimizers.py
imports: import math
  import matplotlib.pyplot
  import numpy
  import torch
  from hyperopt import fmin, hp, tpe
  import torch_optimizer
label_desc: Use image node_id 3 for calling a global function with example usage: execute_steps(func, initial_state, optimizer_class, optimizer_config, num_iter) and returns: steps