code: def _test_master_maintain_logic_baseline(self):
      for _t in range(10):
          self.optimizer.zero_grad()
          for pair in self.data_set:
              y_pred = (
                  pair[0]
                  .mm(self.parameters[0])
                  .clamp(min=0)
                  .mm(self.parameters[1])
              )
              loss = (y_pred - pair[1]).pow(
                  2
              ).sum() * self.fake_fp16_optim.loss_scaler.scale
              loss = loss / len(self.data_set)
              loss.backward()
  
          # from w1, w2 to w1_copy, w2_copy
          for model, master in zip(
              self._generate_params(self.optimizer.param_groups),
              self._generate_params(self.inner_optimizer.param_groups),
          ):
              if master.grad is None:
                  master.grad = torch.empty_like(master)
              master.grad.copy_(model.grad)
  
          # step
          self.fake_fp16_optim.loss_scaler.check_overflow(
              self.optimizer.param_groups
          )
          if not self.fake_fp16_optim.loss_scaler.is_overflow:
              for p in self._generate_params(
                  self.inner_optimizer.param_groups
              ):
                  p.grad.data.div_(
                      self.fake_fp16_optim.loss_scaler.scale
                  )
              self.inner_optimizer.step()
  
              # copy weight back
              for model, master in zip(
                  self._generate_params(self.optimizer.param_groups),
                  self._generate_params(
                      self.inner_optimizer.param_groups
                  ),
              ):
                  model.data.copy_(master.data)
              self.fake_fp16_optim.loss_scaler.update_scale()
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import copy
  import unittest
  import torch
  from pytext.optimizer import fp16_optimizer
  from torch.autograd import Variable
label_desc: Use image node_id 8 for calling the TestFp16Optimizer obj's underlying member method code with example usage: obj._test_master_maintain_logic_baseline() without return types