code: def test_finite_step(self, stateless):
      self._skip_test_for_stateless(stateless)
  
      inner_optimizer = SGD(learning_rate=0.5)
      optimizer = LossScaleOptimizer(inner_optimizer)
      grads = [
          ops.array([1.0, 6.0, 7.0, 2.0]) * optimizer.initial_scale
      ]
      vars = [backend.Variable([1.0, 2.0, 3.0, 4.0])]
      if stateless:
          optimizer.build(vars)
          vars, _ = optimizer.stateless_apply(
              optimizer.variables, grads, vars
          )
      else:
          optimizer.apply(grads, vars)
      self.assertAllClose(
          vars, [[0.5, -1.0, -0.5, 3.0]], rtol=1e-4, atol=1e-4
      )
  
file_path: keras/keras/optimizers/loss_scale_optimizer_test.py
imports: import numpy
  from absl.testing import parameterized
  from keras import backend
  from keras import ops
  from keras import testing
  from keras.optimizers.loss_scale_optimizer import LossScaleOptimizer
  from keras.optimizers.sgd import SGD
label_desc: Use image node_id 3 for calling the LossScaleOptimizerTest obj's underlying member method code with example usage: obj.test_finite_step(stateless) without return types