code: def test_training_demo(on_device, backend_fw):
      if backend_fw == "numpy":
          # numpy does not support gradients
          pytest.skip()
  
      ivy.set_backend(backend_fw)
  
      class MyModel(ivy.Module):
          def __init__(self):
              self.linear0 = ivy.Linear(3, 64)
              self.linear1 = ivy.Linear(64, 1)
              ivy.Module.__init__(self)
  
          def _forward(self, x):
              x = ivy.relu(self.linear0(x))
              return ivy.sigmoid(self.linear1(x))
  
      model = MyModel()
      optimizer = ivy.Adam(1e-4)
      x_in = ivy.array([1.0, 2.0, 3.0])
      target = ivy.array([0.0])
  
      def loss_fn(v):
          out = model(x_in, v=v)
          return ivy.mean((out - target) ** 2)
  
      for step in range(100):
          loss, grads = ivy.execute_with_gradients(loss_fn, model.v)
          model.v = optimizer.step(model.v, grads)
  
      ivy.previous_backend()
  
imports: import pytest
  import ivy
  import ivy.functional.backends.numpy
label_desc: Use image node_id 2 for calling a global function with example usage: test_training_demo(on_device, backend_fw) and returns: ivy, ivy