class_docstr: Tests different learning rate schedules .
class_docstr_tok: ["Tests","different","learning","rate","schedules","."]
docstr: Test that linear warmup schedule works correctly.
docstr_tok: ["Test","that","linear","warmup","schedule","works","correctly","."]
code: def test_constant_linear_warmup(self):
      """Test that linear warmup schedule works correctly."""
      warmup_steps = 100
      warmup_alpha = 0.1
      config = ml_collections.ConfigDict(
          dict(
              lr_configs={
                  "learning_rate_schedule": "compound",
                  "factors": "constant*linear_warmup",
                  "base_learning_rate": 1.0,
                  "warmup_steps": warmup_steps,
                  "warmup_alpha": warmup_alpha,
              }
          )
      )
      lr_fn = lr_schedules.get_learning_rate_fn(config)
      for step in range(400):
          if step == 0:
              self.assertEqual(lr_fn(step), warmup_alpha)
          if step > 0 and step < warmup_steps:
              self.assertGreater(lr_fn(step), lr_fn(step - 1))
          if step >= warmup_steps:
              self.assertEqual(lr_fn(step), 1.0)
  
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 2 for calling the LearningRateScchedulesTest obj's underlying member method code with example usage: obj.test_constant_linear_warmup() without return types