tensorflow/models · error · ValueError

If is_flow, frames should be given in float32.

Error message

If is_flow, frames should be given in float32.

What it means

Error "If is_flow, frames should be given in float32." thrown in tensorflow/models.

Source

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

  Args:
    frames: A Tensor of dimension [timesteps, input_h, input_w, channels].
    min_resize: Minimum size of the final image dimensions.
    crop_size: Crop size of the final image dimensions.
    is_flow: If is flow, will modify the raw values to account for the resize.
      For example, if the flow image is resized by a factor k, we need to
      multiply the flow values by the same factor k since one pixel displacement
      in the resized image corresponds to only 1/k pixel displacement in the
      original image.
    is_random: Whether perform random crop or central crop.
    seed: Random seed.
    state: the dictionary contains data processing states.
  Returns:
    A Tensor of shape [timesteps, output_h, output_w, channels] of type
      frames.dtype where min(output_h, output_w) = min_resize.
  """
  if is_flow and frames.dtype != tf.float32:
    raise ValueError('If is_flow, frames should be given in float32.')

  if min_resize < crop_size:
    raise ValueError('min_resize should be larger than crop_size. Got '
                     f'({min_resize}, {crop_size}).')

  if is_random:
    min_resize = tf.random.uniform((),
                                   minval=min_resize,
                                   maxval=_VGG_EXPANSION_RATIO * min_resize,
                                   dtype=tf.float32)

  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(min_resize / input_h, tf.float32)
  scale = tf.maximum(scale, tf.cast(min_resize / input_w, tf.float32))

View on GitHub (pinned to e006f5f0d5)

When it happens

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