code: def test_master_maintain_grads_from_model_to_master(self):
      self._generate_inner_optim(False)
      self._pseudo_backward(self.fp16_optim.param_groups)
      # check data type before calling sync grads
      self._is_all_float(self.fp16_optim.inner_optimizer.param_groups)
      self._is_all_half(self.fp16_optim.param_groups)
      self.fp16_optim.grads_update_needed = True
      self.fp16_optim._grads_from_model_to_master()
      self._is_all_half(self.fp16_optim.param_groups)
      self._is_all_float(self.fp16_optim.inner_optimizer.param_groups)
  
      for p in self._generate_params(
          self.fp16_optim.inner_optimizer.param_groups
      ):
          p.grad.data.mul_(self.fp16_optim.loss_scaler.scale)
  
      self._is_grad_equal(
          self.fp16_optim.param_groups,
          self.fp16_optim.inner_optimizer.param_groups,
      )
      self._is_all_half(self.fp16_optim.param_groups)
      self._is_all_float(self.fp16_optim.inner_optimizer.param_groups)
  
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 4 for calling the TestFp16Optimizer obj's underlying member method code with example usage: obj.test_master_maintain_grads_from_model_to_master() without return types