tensorflow/models · error · ValueError
Unknown order
Error message
Unknown order {} What it means
Validation in reorder_object_instances: the order argument selects how object instances are sequenced and only 'none', 'random', 'area', and 'dist2ori' are implemented; any other string falls through all branches and reaches the final else raising this ValueError.
Solutions
- Pass order as one of 'none', 'random', 'area', or 'dist2ori'
- Check the calling config for a typo or unsupported ordering string
- Add a new elif branch if a custom ordering scheme is required
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/pix2seq/utils.py:343 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/7dea80e52a1981db.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/pix2seq/utils.py:343
if order == 'none':
return classes, boxes
assert boxes.shape.rank == 2, 'Must be unbatched'
boxes = tf.reshape(boxes, [-1, 2, 2])
if order == 'random':
idx = tf.random.shuffle(tf.range(tf.shape(boxes)[0]))
elif order == 'area':
areas = tf.cast(
tf.reduce_prod(boxes[:, 1, :] - boxes[:, 0, :], axis=1), tf.int64
) # approximated size.
idx = tf.argsort(areas, direction='DESCENDING')
elif order == 'dist2ori':
y, x = boxes[:, 0], boxes[:, 1] # using top-left corner.
dist2ori = tf.square(y) + tf.square(x)
idx = tf.argsort(dist2ori, direction='ASCENDING')
else:
raise ValueError('Unknown order {}'.format(order))
boxes = tf.reshape(boxes, [-1, 4])
boxes = tf.gather(boxes, idx)
classes = tf.gather(classes, idx)
return boxes, classes
def scale_points(points, scale):
"""Scales points.
Args:
points: Tensor with shape [num_points * 2], [batch, num_points * 2] or
[batch, instances, num_points * 2] where points are organized in (y, x)
format.
scale: Tensor with shape [2] or [batch, 2].
Returns:View on GitHub (pinned to e006f5f0d5)