keras-team/keras · error · TypeError
Invalid `output_size` argument. Expected a tuple or list. Re
Error message
Invalid `output_size` argument. Expected a tuple or list. Received: output_size={output_size} of type {type(output_size).__name__} What it means
Error "Invalid `output_size` argument. Expected a tuple or list. Received: output_size={output_size} of type {type(output_size).__name__}" thrown in keras-team/keras.
Source
Thrown at keras/src/ops/image.py:1135
>>> recon = keras.ops.image.reconstruct_patches(
... patches, size=(3, 3, 3), output_size=(9, 9, 9)
... )
>>> recon.shape
(2, 9, 9, 9, 3)
"""
if not isinstance(size, int):
if not isinstance(size, (tuple, list)):
raise TypeError(
"Invalid `size` argument. Expected an int or a tuple. "
f"Received: size={size} of type {type(size).__name__}"
)
if len(size) not in (2, 3):
raise ValueError(
"Invalid `size` argument. Expected a tuple of length 2 or 3. "
f"Received: size={size} with length {len(size)}"
)
if not isinstance(output_size, (tuple, list)):
raise TypeError(
"Invalid `output_size` argument. Expected a tuple or list. "
f"Received: output_size={output_size} of type "
f"{type(output_size).__name__}"
)
if any_symbolic_tensors((patches,)):
return ReconstructPatches(
size=size,
output_size=output_size,
strides=strides,
padding=padding,
data_format=data_format,
).symbolic_call(patches)
return _reconstruct_patches(
patches,
size,
output_size,View on GitHub (pinned to 7a34a03db6)
When it happens
Trigger: Thrown at keras/src/ops/image.py:1135 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of keras-team/keras@7a34a03db6 (2026-08-25).
Data as JSON: /api/errors/3603fcfba906ec5c.
Report an issue: GitHub.