code: def test_replace_tensors():
      # Create a sample model
      model = SampleModel()
  
      # Call extract_tensors function to get the tensors
      _, tensors = extract_tensors(model)
  
      # Create a new device for testing
      device = torch.device("cpu")
  
      # Call replace_tensors function
      replace_tensors(model, tensors, device)
  
      # Assert that the tensors are restored
      for module, tensor_dict in zip(model.modules(), tensors):
          for name, array in tensor_dict["params"].items():
              assert name in module._parameters
              assert torch.allclose(
                  module._parameters[name],
                  torch.as_tensor(array, device=device),
              )
  
          for name, array in tensor_dict["buffers"].items():
              assert name in module._buffers
              assert torch.allclose(
                  module._buffers[name],
                  torch.as_tensor(array, device=device),
              )
  
imports: import pytest
  import torch
  from transformers import AutoModelForCausalLM
  from ludwig.utils.model_utils import contains_nan_or_inf_tensors, extract_tensors, find_embedding_layer_with_path, replace_tensors
label_desc: Use image node_id 2 for calling a global function with example usage: test_replace_tensors() without return types