code: def _run_if_in_graph_mode(self, val):
      # Running only in graph mode is useful, because optimizers sometimes return
      # a value that, in Graph mode, is runnable with self.evaluate. But in Eager
      # mode, the optimizer already does the computations and the return value
      # cannot be run.
      if not context.executing_eagerly():
          self.evaluate(val)
  
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 1 for calling the MixedPrecisionLossScaleOptimizerTest obj's underlying member method code with example usage: obj._run_if_in_graph_mode(val) without return types