tensorflow/models · error · ValueError

max_resize should not be larger than pad_size. Got ({max_res

Error message

max_resize should not be larger than pad_size. Got ({max_resize}, {pad_size}).

What it means

Error "max_resize should not be larger than pad_size. Got ({max_resize}, {pad_size})." thrown in tensorflow/models.

Source

Thrown at official/projects/videoglue/datasets/common/processors.py:513

    pad_size: int,
    random: bool = False,
    seed: Optional[int] = None,
    state: Optional[MutableMapping[str, tf.Tensor]] = None) -> tf.Tensor:
  """Resizes the largest and pads frames.

  Args:
    frames: A Tensor of dimension [timesteps, input_h, input_w, channels].
    max_resize: Maximum size of the final image dimensions.
    pad_size: Pad size of the final image dimensions.
    random: If true, perform random crop; otherwise, perform central crop.
    seed: Random seed.
    state: The dictionary contains random state.
  Returns:
    A Tensor of shape [timesteps, output_h, output_w, channels] of type
      frames.dtype where min(output_h, output_w) = max_resize.
  """
  if max_resize > pad_size:
    raise ValueError('max_resize should not be larger than pad_size. Got '
                     f'({max_resize}, {pad_size}).')

  pad_color = tf.reduce_mean(frames, axis=[0, 1, 2])

  shape = tf.shape(input=frames)
  image_size = tf.cast(shape[1:3], tf.float32)
  input_h = image_size[0]
  input_w = image_size[1]

  scale = tf.cast(max_resize / input_h, tf.float32)
  scale = tf.minimum(scale, tf.cast(max_resize / input_w, tf.float32))

  scale_h = input_h * scale
  scale_w = input_w * scale

  frames_resized = tf.image.resize(
      frames, (scale_h, scale_w), method=tf.image.ResizeMethod.BILINEAR)
  frames = tf.cast(frames_resized, frames.dtype)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/videoglue/datasets/common/processors.py:513 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/9427ac61ceb800bf. Report an issue: GitHub.