def METHOD_NAME(self):
    opt = gradient_descent_v2.SGD(1.0)
    opt = tf.compat.v1.mixed_precision.enable_mixed_precision_graph_rewrite(
        opt, "dynamic"
    )
    self.assertIsInstance(opt, loss_scale_optimizer_v2.LossScaleOptimizer)
    self.evaluate(tf.compat.v1.global_variables_initializer())
    self.assertEqual(self.evaluate(opt.loss_scale), 2.0**15)
    self.assertTrue(opt.dynamic)
    self.assertTrue(opt.initial_scale, 2.0**15)
    self.assertTrue(opt.dynamic_growth_steps, 2000)
    opt = gradient_descent_v2.SGD(1.0)
    opt = tf.compat.v1.mixed_precision.enable_mixed_precision_graph_rewrite(
        opt,
        tf.compat.v1.mixed_precision.DynamicLossScale(
            initial_loss_scale=4, increment_period=1000
        ),
    )
    self.assertIsInstance(opt, loss_scale_optimizer_v2.LossScaleOptimizer)
    self.evaluate(tf.compat.v1.global_variables_initializer())
    self.assertEqual(self.evaluate(opt.loss_scale), 4.0)
    self.assertTrue(opt.dynamic)
    self.assertTrue(opt.initial_scale, 4.0)
    self.assertTrue(opt.dynamic_growth_steps, 1000)