tensorflow/models · error · ValueError
match_results should be an int32 or int64 scalar tensor
Error message
match_results should be an int32 or int64 scalar tensor
What it means
Error "match_results should be an int32 or int64 scalar tensor" thrown in tensorflow/models.
Source
Thrown at official/vision/utils/object_detection/matcher.py:62
"""
def __init__(self, match_results):
"""Constructs a Match object.
Args:
match_results: Integer tensor of shape [N] with (1) match_results[i]>=0,
meaning that column i is matched with row match_results[i]. (2)
match_results[i]=-1, meaning that column i is not matched. (3)
match_results[i]=-2, meaning that column i is ignored.
Raises:
ValueError: if match_results does not have rank 1 or is not an
integer int32 scalar tensor
"""
if match_results.shape.ndims != 1:
raise ValueError('match_results should have rank 1')
if match_results.dtype != tf.int32:
raise ValueError('match_results should be an int32 or int64 scalar '
'tensor')
self._match_results = match_results
@property
def match_results(self):
"""The accessor for match results.
Returns:
the tensor which encodes the match results.
"""
return self._match_results
def matched_column_indices(self):
"""Returns column indices that match to some row.
The indices returned by this op are always sorted in increasing order.
Returns:View on GitHub (pinned to e006f5f0d5)
Solutions
- Pass match_results as an int32 or int64 tensor.
- Cast the match results with tf.cast(x, tf.int32).
When it happens
Trigger: Thrown at official/vision/utils/object_detection/matcher.py:62 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/fe48cabdea8db802.
Report an issue: GitHub.