code: def test_state_mutation():
      model = torch.nn.Linear(3, 4)
      optimizer0 = torch.optim.Adam(model.parameters(), lr=0.1)
      lightning_optimizer0 = LightningOptimizer(optimizer0)
  
      optimizer0.param_groups[0]["lr"] = 1.0
      assert lightning_optimizer0.param_groups[0]["lr"] == 1.0
  
      # Load state into the unwrapped optimizer
      state_dict0 = deepcopy(optimizer0.state_dict())
      optimizer1 = torch.optim.Adam(model.parameters(), lr=100)
      lightning_optimizer1 = LightningOptimizer(optimizer1)
      optimizer1.load_state_dict(state_dict0)
      assert lightning_optimizer1.param_groups[0]["lr"] == 1.0
  
      # Load state into wrapped optimizer
      optimizer2 = torch.optim.Adam(model.parameters(), lr=100)
      lightning_optimizer2 = LightningOptimizer(optimizer2)
      lightning_optimizer2.load_state_dict(state_dict0)
      assert lightning_optimizer2.param_groups[0]["lr"] == 1.0
  
imports: from copy import deepcopy
  from unittest.mock import DEFAULT, Mock, patch
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.core.optimizer import LightningOptimizer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.loops.optimization.automatic import Closure
  from lightning.pytorch.tuner.tuning import Tuner
  from torch.optim import SGD, Adam, Optimizer
label_desc: Use image node_id 5 for calling a global function with example usage: test_state_mutation() without return types