{"record":{"id":"c8918d890024ba01","repo":"tensorflow/models","slug":"boundaries-length-is-equal-to-learning-rate-levels","errorCode":null,"errorMessage":"Boundaries length is equal to learning rate levels length{len(self.boundaries)} != {len(self.values)}","messagePattern":"Boundaries length is equal to learning rate levels length(.+?) != (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/modeling/optimization/lr_schedule.py","lineNumber":445,"sourceCode":"        increasing entries, and with all elements having the same type as the\n        optimizer step.\n      values: A list of `Tensor`s or `float`s that specifies the\n        values for the intervals defined by `boundaries`. It should have one\n        more element than `boundaries`, and all elements should have the same\n        type.\n      offset: The offset when computing the power decay.\n      name: Optional, name of learning rate schedule.\n    \"\"\"\n    super().__init__()\n    self.values = values\n    self.boundaries = boundaries\n    self.offset = offset\n    self.name = name\n\n    if len(self.values) < 1:\n      raise ValueError(f\"Expect non empty {self.values}\")\n    if len(self.boundaries) != len(self.values):\n      raise ValueError(\n          \"Boundaries length is equal to learning rate levels length\"\n          f\"{len(self.boundaries)} != {len(self.values)}\")\n\n    self.total_steps = (\n        [boundaries[i + 1] - boundaries[i] for i in range(len(boundaries) - 1)\n        ] + [0])\n\n  def __call__(self, global_step):\n    with tf.name_scope(self.name or \"StepCosineDecayWithOffset\"):\n      global_step = tf.cast(global_step - self.offset, tf.float32)\n      lr_levels = self.values\n      lr_steps = self.boundaries\n      level_total_steps = self.total_steps\n      num_levels = len(lr_levels)\n\n      init_lr = lr_levels[0]\n      next_init_lr = lr_levels[1] if num_levels > 1 else 0.\n","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/modeling/optimization/lr_schedule.py#L427-L463","documentation":"Error \"Boundaries length is equal to learning rate levels length{len(self.boundaries)} != {len(self.values)}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/modeling/optimization/lr_schedule.py:445 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}