code: def test_module_save_and_load_as_pickled(
      batch_shape,
      input_channels,
      output_channels,
      on_device,
      backend_fw,
  ):
      save_filepath = "module.pickled"
  
      # smoke test
      if backend_fw == "numpy":
          # NumPy does not support gradients
          return
  
      with ivy.utils.backend.ContextManager(backend_fw):
          x = ivy.astype(
              ivy.linspace(
                  ivy.zeros(batch_shape),
                  ivy.ones(batch_shape),
                  input_channels,
              ),
              "float32",
          )
          module = TrainableModule(
              input_channels, output_channels, device=on_device
          )
  
          def loss_fn(v_):
              out = module(x, v=v_)
              return ivy.mean(out)
  
          module.save(save_filepath)
          assert os.path.exists(save_filepath)
          loaded_module = ivy.Module.load(save_filepath)
  
          # train
          loss, grads = ivy.execute_with_gradients(loss_fn, module.v)
          module.v = ivy.gradient_descent_update(module.v, grads, 1e-3)
  
          loaded_loss, loaded_grads = ivy.execute_with_gradients(
              loss_fn, loaded_module.v
          )
          loaded_module.v = ivy.gradient_descent_update(
              loaded_module.v, loaded_grads, 1e-3
          )
  
          # type test
          assert ivy.is_array(loaded_loss)
          assert isinstance(loaded_grads, ivy.Container)
          # cardinality test
          assert loaded_loss.shape == ()
          # value test
          assert ivy.all_equal(loaded_loss == loss)
          assert ivy.Container.all(
              loaded_module.v == module.v
          ).cont_all_true()
  
          os.remove(save_filepath)
  
imports: import os
  from hypothesis import given, strategies
  import numpy
  import ivy
  from ivy.functional.ivy.gradients import _variable
  import ivy_tests.test_ivy.helpers
label_desc: Use image node_id 2 for calling a global function with example usage: test_module_save_and_load_as_pickled(batch_shape, input_channels, output_channels, on_device, backend_fw) and returns: ivy