code: def test_mixed_precision(self):
      model = copy.deepcopy(self.model)
      params = list(model.parameters())
      optimizer = FP16Optimizer.build_optimizer(self.cfg_dls, params)
  
      self.run_iter(model, params, optimizer)
      self.assertTrue(
          all(
              torch.all(
                  fp32_params.eq(
                      torch.tensor(
                          [3.1000, 5.1000],
                          device="cuda:0",
                          requires_grad=True,
                      )
                  )
              )
              for fp32_params in optimizer.fp32_params.values()
          )
      )
  
file_path: fairseq/tests/test_fp16_optimizer.py
imports: import copy
  import logging
  import unittest
  import torch
  from fairseq.optim.fp16_optimizer import FP16Optimizer, MemoryEfficientFP16Optimizer
  from omegaconf import OmegaConf
label_desc: Use image node_id 4 for calling the TestGradientScaling obj's underlying member method code with example usage: obj.test_mixed_precision() without return types