tensorflow/models · error · TypeError
The argument must be a tuple of integers. Received
Error message
The {name} argument must be a tuple of {n} integers. Received: {value} What it means
Raised in _normalize_tuple when a kernel/stride argument is not an int and not iterable, so it cannot be converted to an n-tuple of integers. The error is re-raised from the failed tuple() conversion.
Solutions
- Pass the argument as a tuple of exactly n integers.
- Wrap scalar values into a tuple of the required length.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/vision/ops/augment.py:171 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/b3c9db1fc0d97743.
Report an issue: GitHub.
Appendix: source
Thrown at official/vision/ops/augment.py:171
ints.
n: The size of the tuple to be returned.
name: The name of the argument being validated, e.g. "strides" or
"kernel_size". This is only used to format error messages.
Returns:
A tuple of n integers.
Raises:
ValueError: If something else than an int/long or iterable thereof was
passed.
"""
if isinstance(value, int):
return (value,) * n
else:
try:
value_tuple = tuple(value)
except TypeError as exc:
raise TypeError(
f'The {name} argument must be a tuple of {n} integers. '
f'Received: {value}'
) from exc
if len(value_tuple) != n:
raise ValueError(
f'The {name} argument must be a tuple of {n} integers. '
f'Received: {value}'
)
for single_value in value_tuple:
try:
int(single_value)
except (ValueError, TypeError) as exc:
raise ValueError(
f'The {name} argument must be a tuple of {n} integers. Received:'
f' {value} including element {single_value} of type'
f' {type(single_value)}.'
) from exc
return value_tupleView on GitHub (pinned to e006f5f0d5)