{"record":{"id":"be72ff4a4f251769","repo":"tensorflow/models","slug":"the-length-of-boundaries-must-be-1-less-than-the-l","errorCode":null,"errorMessage":"The length of boundaries must be 1 less than the length of multipliers","messagePattern":"The length of boundaries must be 1 less than the length of multipliers","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/image_classification/resnet/common.py","lineNumber":51,"sourceCode":"    (1.0, 5), (0.1, 30), (0.01, 60), (0.001, 80)\n]\n\n\nclass PiecewiseConstantDecayWithWarmup(\n    tf_keras.optimizers.schedules.LearningRateSchedule):\n  \"\"\"Piecewise constant decay with warmup schedule.\"\"\"\n\n  def __init__(self,\n               batch_size,\n               epoch_size,\n               warmup_epochs,\n               boundaries,\n               multipliers,\n               compute_lr_on_cpu=True,\n               name=None):\n    super(PiecewiseConstantDecayWithWarmup, self).__init__()\n    if len(boundaries) != len(multipliers) - 1:\n      raise ValueError('The length of boundaries must be 1 less than the '\n                       'length of multipliers')\n\n    base_lr_batch_size = 256\n    steps_per_epoch = epoch_size // batch_size\n\n    self.rescaled_lr = BASE_LEARNING_RATE * batch_size / base_lr_batch_size\n    self.step_boundaries = [float(steps_per_epoch) * x for x in boundaries]\n    self.lr_values = [self.rescaled_lr * m for m in multipliers]\n    self.warmup_steps = warmup_epochs * steps_per_epoch\n    self.compute_lr_on_cpu = compute_lr_on_cpu\n    self.name = name\n\n    self.learning_rate_ops_cache = {}\n\n  def __call__(self, step):\n    if tf.executing_eagerly():\n      return self._get_learning_rate(step)\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/image_classification/resnet/common.py#L33-L69","documentation":"Error \"The length of boundaries must be 1 less than the length of multipliers\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/image_classification/resnet/common.py:51 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"}