code: def test_sequential_same_as_class(input_array, dims, backend_fw):
      with ivy.utils.backend.ContextManager(backend_fw):
          dims = [len(input_array)] + dims
          layer_count = len(dims)
          layers = [
              ivy.Linear(dims[i], dims[i + 1])
              for i in range(layer_count - 1)
          ]
  
          m_sequential = ivy.Sequential(*layers)
          m_class = TrainableModule(dims[0], dims[1], dims[2])
  
          # copy weights
          _copy_weights(m_class.v.linear0, m_sequential.v.submodules.v0)
          _copy_weights(m_class.v.linear1, m_sequential.v.submodules.v1)
  
          input_array = ivy.array(input_array, dtype="float32")
  
          if backend_fw != "numpy":
              sequential_loss = _train(m_sequential, input_array)
              class_loss = _train(m_class, input_array)
              assert sequential_loss == class_loss
  
file_path: ivy/ivy_tests/test_ivy/test_stateful/test_sequential.py
imports: import itertools
  from hypothesis import strategies
  import ivy
  from ivy_tests.test_ivy import helpers
  from ivy_tests.test_ivy.helpers.testing_helpers import handle_method
label_desc: Use image node_id 4 for calling a global function with example usage: test_sequential_same_as_class(input_array, dims, backend_fw) without return types