code: def test_empty_init(monkeypatch):
      """Test that `_EmptyInit()` skips initialization and allocates uninitialized memory."""
      init_mock = Mock()
      monkeypatch.setattr(torch.Tensor, "uniform_", init_mock)
  
      with _EmptyInit(enabled=True):
          torch.nn.Linear(2, 2, device="cuda")
      init_mock.assert_not_called()
  
      with _EmptyInit(enabled=False):
          torch.nn.Linear(2, 2, device="cuda")
      init_mock.assert_called()
  
file_path: pytorch-lightning/tests/tests_fabric/utilities/test_init.py
imports: import time
  from unittest import mock
  from unittest.mock import Mock
  import pytest
  import torch.nn
  from lightning.fabric.utilities.init import _EmptyInit, _materialize_meta_tensors
  from tests_fabric.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: test_empty_init(monkeypatch) without return types