def METHOD_NAME(self):
    pg = DummyProcessGroup(0, 1)
    scaler = ShardedGradScaler(init_scale=2.0, process_group=pg, enabled=True)
    inv_scale = torch.full((1,), 0.5, dtype=torch.float, device="cpu")
    found_inf = torch.full((1,), 0, dtype=torch.float, device="cpu")
    i = torch.tensor([[0, 1, 1], [2, 0, 2]], device="cpu", dtype=torch.int64)
    v = torch.tensor([16.0, 32.0, 64.0], dtype=torch.float, device="cpu")
    s = torch.sparse_coo_tensor(
        i, v, torch.Size([2, 3]), device="cpu", dtype=torch.float
    )
    # unscale sparse tensors
    s1 = s.clone()
    s1.grad = s.clone()
    opt = torch.optim.SGD([s1], lr=1.0)
    found_inf.zero_()
    found_inf = scaler._unscale_grads_(opt, inv_scale, found_inf)[s1.device]
    self.assertEqual(found_inf, 0.0)
    self.assertEqual(s1.grad.to_dense(), (s / 2).to_dense())
    # unscale sparse tensor: inf
    v = torch.tensor([16.0, 32.0, float("inf")], dtype=torch.float, device="cpu")
    s1.grad = torch.sparse_coo_tensor(
        i, v, torch.Size([2, 3]), device="cpu", dtype=torch.float
    )
    found_inf.zero_()
    found_inf = scaler._unscale_grads_(opt, inv_scale, found_inf)[s1.device]
    self.assertEqual(found_inf, 1.0)
    # unscale sparse tensor: overflow (marked as inf)
    i = torch.tensor([[1, 1, 1], [0, 0, 2]], device="cpu", dtype=torch.int64)
    # coalescing sparse tensor here will cause the value to be Inf
    v = torch.tensor([2**15, 2**15, 1.0], dtype=torch.float16, device="cpu")
    s1 = torch.sparse_coo_tensor(
        i, v, torch.Size([2, 3]), device="cpu", dtype=torch.float16
    )
    s1.grad = s1.clone()
    found_inf.zero_()
    found_inf = scaler._unscale_grads_(opt, inv_scale, found_inf)[s1.device]
    self.assertEqual(found_inf, 1.0)