code: def test_module_to_device(dummy, on_device, backend_fw):
      with ivy.utils.backend.ContextManager(backend_fw):
          model = TrainableModule(5, 5)
          model.to_device(on_device)
  
          def assertion(x, on_device):
              if x != on_device:
                  print(f"{x} is not equal to {on_device}")
                  raise AssertionError
  
          def model_assert(mod, on_device):
              for obj in mod.v.values():
                  if isinstance(obj, ivy.Module):
                      return model_assert(obj, on_device)
                  if isinstance(obj, (ivy.Container, dict)):
                      for item2 in obj.values():
                          assertion(item2.device, on_device)
  
                  else:
                      assertion(obj.device, on_device)
              if getattr(mod, "buffers", None):
                  for obj in mod.buffers.values():
                      if isinstance(obj, (ivy.Container, dict)):
                          ivy.nested_map(
                              lambda x: assertion(x.device, on_device),
                              obj,
                          )
                      else:
                          assertion(obj.device, on_device)
  
          model_assert(model, on_device)
  
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 3 for calling a global function with example usage: test_module_to_device(dummy, on_device, backend_fw) and returns: model_assert