tensorflow/models · error · ValueError
`axis` out of bounds for `tensor` rank.
Error message
`axis` out of bounds for `tensor` rank.
What it means
Error "`axis` out of bounds for `tensor` rank." thrown in tensorflow/models.
Source
Thrown at official/projects/triviaqa/inputs.py:115
constant_values: For 'CONSTANT' mode, the scalar pad value to use within
`tf.pad`. Defaults to 0. Must be same type as `tensor`.
name: A name for the operation (optional).
Returns:
The padded Tensor result.
"""
with tf.name_scope(name or 'pad_to_multiple'):
tensor = tf.convert_to_tensor(tensor)
if isinstance(factor, int) and factor < 1:
raise ValueError('`factor` must be positive.')
rank = tensor.shape.rank
if rank is None:
raise ValueError('Static rank of `tensor` must be known.')
if axis < 0:
axis += rank
if axis < 0 or axis >= rank:
raise ValueError('`axis` out of bounds for `tensor` rank.')
axis_len = tf_utils.get_shape_list(tensor)[axis]
pad_len = -axis_len % factor
paddings = pad_len * tf.one_hot([-1, axis], rank, axis=0, dtype=tf.int32)
return tf.pad(
tensor=tensor,
paddings=paddings,
mode=mode,
constant_values=constant_values)
def _skew_elements_right(tensor: tf.Tensor,
axis: int,
pad_value=0,
name: Optional[Text] = None) -> tf.Tensor:
"""Skews successive elements right along the given `axis`.
This changes an input likeView on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/triviaqa/inputs.py:115 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/cfe531fe123f6afe.
Report an issue: GitHub.