class_docstr: Tests different learning rate schedules .
class_docstr_tok: ["Tests","different","learning","rate","schedules","."]
docstr: Test polynomial schedule works correctly.
docstr_tok: ["Test","polynomial","schedule","works","correctly","."]
code: def test_polynomial_decay(self):
      """Test polynomial schedule works correctly."""
      config = ml_collections.ConfigDict(
          dict(
              lr_configs={
                  "learning_rate_schedule": "compound",
                  "factors": "constant*polynomial",
                  "decay_steps": 200,
                  "power": 2.0,
                  "base_learning_rate": 0.1,
                  "end_factor": 0.01,
              }
          )
      )
      lr_fn = lr_schedules.get_learning_rate_fn(config)
      config = config.lr_configs
      tf_polynomial_decay = (
          tf.keras.optimizers.schedules.PolynomialDecay(
              initial_learning_rate=config["base_learning_rate"],
              decay_steps=config["decay_steps"],
              end_learning_rate=config["end_factor"]
              * config["base_learning_rate"],
              power=config["power"],
          )
      )
      for step in range(400):
          expected_learning_rate = tf_polynomial_decay(
              step=step
          ).numpy()
          self.assertAlmostEqual(lr_fn(step), expected_learning_rate)
  
file_path: scenic/scenic/train_lib/tests/test_lr_schedules.py
imports: from absl.testing import absltest
  import ml_collections
  from scenic.train_lib import lr_schedules
  import tensorflow
label_desc: Use image node_id 3 for calling the LearningRateScchedulesTest obj's underlying member method code with example usage: obj.test_polynomial_decay() without return types