code: def test_step_with_grad_scaler():
      weight, bias, input = make_half_precision_params()
      optimizer = Adam(
          [weight, bias], lr=1e-3, precision=Precision.PURE_FP16
      )
      scaler = GradScaler()
      initial_value = None
  
      for _i in range(5):
          optimizer.zero_grad()
          loss = (weight.mv(input) + bias).pow(2).sum()
          if _i == 0:
              initial_value = loss.item()
          scaler.scale(loss).backward()
          scaler.step(optimizer)
          scaler.update()
  
      assert loss.item() < initial_value
  
imports: from copy import deepcopy
  import functools
  import pytest
  import torch
label_desc: Use image node_id 14 for calling a global function with example usage: test_step_with_grad_scaler() without return types