code: def test_materialize_tensors(tmp_path):
      # Single tensor
      tensor = torch.tensor([1, 2])
      torch.save(tensor, tmp_path / "tensor.pt")
      loaded = _lazy_load(tmp_path / "tensor.pt")
      materialized = _materialize_tensors(loaded)
      assert torch.equal(materialized, tensor)
      assert type(tensor) == type(materialized)
  
      # Collection of tensors
      collection = {
          "tensor": torch.tensor([1, 2]),
          "nested": {
              "int": 1,
              "list": [torch.tensor([3.0]), torch.tensor([4])],
          },
      }
      torch.save(collection, tmp_path / "collection.pt")
      loaded = _lazy_load(tmp_path / "collection.pt")
      materialized = _materialize_tensors(loaded)
      assert torch.equal(materialized["tensor"], collection["tensor"])
      assert torch.equal(
          materialized["nested"]["list"][0],
          collection["nested"]["list"][0],
      )
      assert torch.equal(
          materialized["nested"]["list"][1],
          collection["nested"]["list"][1],
      )
      assert materialized["nested"]["int"] == 1
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_load.py
imports: import pytest
  import torch
  import torch.nn
  from lightning.fabric.utilities.load import _lazy_load, _materialize_tensors, _move_state_into, _NotYetLoadedTensor
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 5 for calling a global function with example usage: test_materialize_tensors(tmp_path) without return types