{"record":{"id":"4b8c263e93e8ed58","repo":"tensorflow/models","slug":"does-not-have-enough-elements-to-gather","errorCode":null,"errorMessage":"{} does not have enough elements to gather, {} < {}","messagePattern":"(.+?) does not have enough elements to gather, (.+?) < (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/pointpillars/utils/wod_detection_evaluator.py","lineNumber":54,"sourceCode":"  def __init__(self, model_config, config=None):\n    super().__init__(config=config)\n\n    image_config = model_config.image\n    self._resolution = image_config.resolution\n    self._vehicle_xy = utils.get_vehicle_xy(image_config.height,\n                                            image_config.width,\n                                            image_config.x_range,\n                                            image_config.y_range)\n    self._classes = model_config.classes\n\n  def _remove_padding(self, tensor_dict: Mapping[str, Any],\n                      num_valid: int) -> Mapping[str, Any]:\n    \"\"\"Remove the paddings of the prediction/groundtruth data.\"\"\"\n    result_tensor_dict = {}\n    gather_indices = tf.range(num_valid)\n    for k, v in tensor_dict.items():\n      if v.shape[0] < num_valid:\n        raise ValueError(\n            '{} does not have enough elements to gather, {} < {}'.format(\n                k, v.shape[0], num_valid))\n      result_tensor_dict[k] = tf.gather(v, gather_indices)\n    return result_tensor_dict\n\n  def _compact_tensors(self,\n                       tensor_dict: Mapping[str, Any]) -> Mapping[str, Any]:\n    \"\"\"Compact tensors by concatenating them in tuples.\"\"\"\n    compact_tensor_dict = {}\n    for k, v in tensor_dict.items():\n      if isinstance(v, tuple):\n        compact_tensor_dict[k] = tf.concat(v, axis=0)\n      elif isinstance(v, dict):\n        compact_tensor_dict[k] = v\n        for dk, dv in v.items():\n          if isinstance(dv, tuple):\n            compact_tensor_dict[k][dk] = tf.concat(dv, axis=0)\n      else:","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/pointpillars/utils/wod_detection_evaluator.py#L36-L72","documentation":"Error \"{} does not have enough elements to gather, {} < {}\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/pointpillars/utils/wod_detection_evaluator.py:54 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"}