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/vision/ops/augment.py:431

  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(

View on GitHub (pinned to e006f5f0d5)

Solutions

  1. Pass output_shape as a 1-D tensor of exactly 2 elements [new_height, new_width].
  2. Trim or fix the output_shape tensor so it has shape (2,).

When it happens

Trigger: Thrown at official/vision/ops/augment.py:431 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/1bb9c349500cf2fb. Report an issue: GitHub.