code: def test_amp_gradient_unscale(tmpdir, accum: int):
      model = TestPrecisionModel()
  
      trainer = Trainer(
          max_epochs=2,
          default_root_dir=tmpdir,
          limit_train_batches=2,
          limit_val_batches=0,
          strategy="ddp_spawn",
          accelerator="gpu",
          devices=2,
          precision="16-mixed",
          # use a tiny value to make sure it works
          gradient_clip_val=1e-3,
          gradient_clip_algorithm="value",
          log_every_n_steps=1,
          accumulate_grad_batches=accum,
          enable_progress_bar=False,
      )
      trainer.fit(model)
  
imports: import os
  import re
  from unittest import mock
  import pytest
  import torch
  from lightning.pytorch import Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.plugins import MixedPrecision
  from torch import Tensor
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 2 for calling a global function with example usage: test_amp_gradient_unscale(tmpdir, accum) without return types