tensorflow/models · error · ValueError
output_shape must be a 1-D Tensor of 2 elements: new_height,
Error message
output_shape must be a 1-D Tensor of 2 elements: new_height, new_width, instead got output_shape={output_shape} What it means
Error "output_shape must be a 1-D Tensor of 2 elements: new_height, new_width, instead got output_shape={output_shape}" thrown in tensorflow/models.
Source
Thrown at official/legacy/image_classification/augment.py:227
Returns:
Image(s) with the same type and shape as `images`, with the given
transform(s) applied. Transformed coordinates outside of the input image
will be filled with zeros.
"""
with tf.name_scope(name or 'transform'):
if output_shape is None:
output_shape = tf.shape(images)[1:3]
if not tf.executing_eagerly():
output_shape_value = tf.get_static_value(output_shape)
if output_shape_value is not None:
output_shape = output_shape_value
output_shape = tf.convert_to_tensor(
output_shape, tf.int32, name='output_shape'
)
if not output_shape.get_shape().is_compatible_with([2]):
raise ValueError(
'output_shape must be a 1-D Tensor of 2 elements: '
'new_height, new_width, instead got '
f'output_shape={output_shape}'
)
fill_value = tf.convert_to_tensor(fill_value, tf.float32, name='fill_value')
return tf.raw_ops.ImageProjectiveTransformV3(
images=images,
output_shape=output_shape,
fill_value=fill_value,
transforms=transforms,
fill_mode=fill_mode.upper(),
interpolation=interpolation.upper(),
)
def transform(image: tf.Tensor, transforms) -> tf.Tensor:View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/legacy/image_classification/augment.py:227 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/0aec244cf94018d2.
Report an issue: GitHub.