{"record":{"id":"e104ef5456d7ce09","repo":"tensorflow/models","slug":"mode-is-not-defined-e104ef","errorCode":null,"errorMessage":"mode is not defined.","messagePattern":"mode is not defined\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/legacy/detection/dataloader/retinanet_parser.py","lineNumber":153,"sourceCode":"    self._aug_scale_min = aug_scale_min\n    self._aug_scale_max = aug_scale_max\n\n    # Data Augmentation with AutoAugment.\n    self._use_autoaugment = use_autoaugment\n    self._autoaugment_policy_name = autoaugment_policy_name\n\n    # Device.\n    self._use_bfloat16 = use_bfloat16\n\n    # Data is parsed depending on the model Modekey.\n    if mode == ModeKeys.TRAIN:\n      self._parse_fn = self._parse_train_data\n    elif mode == ModeKeys.EVAL:\n      self._parse_fn = self._parse_eval_data\n    elif mode == ModeKeys.PREDICT or mode == ModeKeys.PREDICT_WITH_GT:\n      self._parse_fn = self._parse_predict_data\n    else:\n      raise ValueError('mode is not defined.')\n\n  def __call__(self, value):\n    \"\"\"Parses data to an image and associated training labels.\n\n    Args:\n      value: a string tensor holding a serialized tf.Example proto.\n\n    Returns:\n      image: image tensor that is preproessed to have normalized value and\n        dimension [output_size[0], output_size[1], 3]\n      labels:\n        cls_targets: ordered dictionary with keys\n          [min_level, min_level+1, ..., max_level]. The values are tensor with\n          shape [height_l, width_l, anchors_per_location]. The height_l and\n          width_l represent the dimension of class logits at l-th level.\n        box_targets: ordered dictionary with keys\n          [min_level, min_level+1, ..., max_level]. The values are tensor with\n          shape [height_l, width_l, anchors_per_location * 4]. The height_l and","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/dataloader/retinanet_parser.py#L135-L171","documentation":"Error \"mode is not defined.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/detection/dataloader/retinanet_parser.py:153 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"}