code: def _test_helper(
      self,
      inputs,
      expected_outputs,
      initial_loss_scale=1.0,
      increment_period=2,
      multiplier=2,
  ):
      loss_scale = loss_scale_module.DynamicLossScale(
          initial_loss_scale=initial_loss_scale,
          increment_period=increment_period,
          multiplier=multiplier,
      )
      itr = _get_example_iter(inputs)
  
      def update():
          is_finite = itr.get_next()
          grad = self._get_tensor(is_finite)
          update_op, should_apply_gradients = loss_scale.update([grad])
          assert_op = check_ops.assert_equal(
              should_apply_gradients, is_finite
          )
          if context.executing_eagerly():
              return
          with ops.control_dependencies([assert_op]):
              return array_ops.identity(update_op)
  
      actual_outputs = []
  
      if not context.executing_eagerly():
          update_op = update()
          self.evaluate(variables.global_variables_initializer())
      for _ in range(len(inputs)):
          if context.executing_eagerly():
              update()
          else:
              self.evaluate(update_op)
          actual_outputs.append(self.evaluate(loss_scale()))
      self.assertEqual(actual_outputs, expected_outputs)
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.data.ops import dataset_ops
  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 constant_op
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor
  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 cond
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
  from tensorflow.python.training.experimental import loss_scale
label_desc: Use image node_id 2 for calling the DynamicLossScaleTest obj's underlying member method code with example usage: obj._test_helper(inputs, expected_outputs, initial_loss_scale, increment_period, multiplier) and returns: array_ops