tensorflow/models · error · ValueError
{} does not have enough elements to gather, {} < {}
Error message
{} does not have enough elements to gather, {} < {} What it means
Error "{} does not have enough elements to gather, {} < {}" thrown in tensorflow/models.
Source
Thrown at official/projects/pointpillars/utils/wod_detection_evaluator.py:54
def __init__(self, model_config, config=None):
super().__init__(config=config)
image_config = model_config.image
self._resolution = image_config.resolution
self._vehicle_xy = utils.get_vehicle_xy(image_config.height,
image_config.width,
image_config.x_range,
image_config.y_range)
self._classes = model_config.classes
def _remove_padding(self, tensor_dict: Mapping[str, Any],
num_valid: int) -> Mapping[str, Any]:
"""Remove the paddings of the prediction/groundtruth data."""
result_tensor_dict = {}
gather_indices = tf.range(num_valid)
for k, v in tensor_dict.items():
if v.shape[0] < num_valid:
raise ValueError(
'{} does not have enough elements to gather, {} < {}'.format(
k, v.shape[0], num_valid))
result_tensor_dict[k] = tf.gather(v, gather_indices)
return result_tensor_dict
def _compact_tensors(self,
tensor_dict: Mapping[str, Any]) -> Mapping[str, Any]:
"""Compact tensors by concatenating them in tuples."""
compact_tensor_dict = {}
for k, v in tensor_dict.items():
if isinstance(v, tuple):
compact_tensor_dict[k] = tf.concat(v, axis=0)
elif isinstance(v, dict):
compact_tensor_dict[k] = v
for dk, dv in v.items():
if isinstance(dv, tuple):
compact_tensor_dict[k][dk] = tf.concat(dv, axis=0)
else:View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/pointpillars/utils/wod_detection_evaluator.py:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/4b8c263e93e8ed58.
Report an issue: GitHub.