code: def _run_fn_with_grad_check(self, strategy, var, opt, expected_grad):
      grad_check_fn = create_identity_with_grad_check_fn(expected_grad)
      loss = lambda: grad_check_fn(var) / strategy.num_replicas_in_sync
      return lambda: opt.minimize(loss, var_list=[var])
  
imports: import os
  from absl.testing import parameterized
  from tensorflow.python.checkpoint import checkpoint
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import mirrored_strategy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import check_ops
  from tensorflow.python.ops import custom_gradient
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training import gradient_descent
  from tensorflow.python.training import momentum
  from tensorflow.python.training.experimental import loss_scale
  from tensorflow.python.training.experimental import loss_scale_optimizer
label_desc: Use image node_id 2 for calling the MixedPrecisionLossScaleOptimizerTest obj's underlying member method code with example usage: obj._run_fn_with_grad_check(strategy, var, opt, expected_grad) and returns: function