{"record":{"id":"5787c2a62a425ac5","repo":"tensorflow/models","slug":"mode-is-not-defined-5787c2","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/shapemask_parser.py","lineNumber":191,"sourceCode":"    # Control of which category to use.\n    self._use_category = use_category\n    self._num_sampled_masks = num_sampled_masks\n    self._mask_crop_size = mask_crop_size\n    self._mask_min_level = mask_min_level\n    self._mask_max_level = mask_max_level\n    self._outer_box_scale = outer_box_scale\n    self._box_jitter_scale = box_jitter_scale\n    self._up_sample_factor = upsample_factor\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      inputs:\n        image: image tensor that is preproessed to have normalized value and\n          dimension [output_size[0], output_size[1], 3]\n        mask_boxes: sampled boxes that tightly enclose the training masks. The\n          box is represented in [y1, x1, y2, x2] format. The tensor is sampled\n          to the fixed dimension [self._num_sampled_masks, 4].\n        mask_outer_boxes: loose box that enclose sampled tight box. The\n          box is represented in [y1, x1, y2, x2] format. The tensor is sampled\n          to the fixed dimension [self._num_sampled_masks, 4].\n        mask_classes: the class ids of sampled training masks. The tensor has","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/legacy/detection/dataloader/shapemask_parser.py#L173-L209","documentation":"Error \"mode is not defined.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/legacy/detection/dataloader/shapemask_parser.py:191 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"}