tensorflow/models · error · ValueError

Random stride range should be >= 0, got {}

Error message

Random stride range should be >= 0, got {}

What it means

Error "Random stride range should be >= 0, got {}" thrown in tensorflow/models.

Source

Thrown at official/vision/dataloaders/video_input.py:98

    max_area_ratio: The maximum area range for cropping.
    random_rotation: Use uniform random rotation augmentation or not.
    augmenter: Image augmenter to distort each image.
    seed: A deterministic seed to use when sampling.
    input_image_format: The format of input image which could be jpeg, png or
      none for unknown or mixed datasets.

  Returns:
    Processed frames. Tensor of shape
      [num_frames * num_test_clips, crop_height, crop_width, num_channels].
  """
  # Validate parameters.
  if is_training and num_test_clips != 1:
    logging.warning(
        '`num_test_clips` %d is ignored since `is_training` is `True`.',
        num_test_clips)

  if random_stride_range < 0:
    raise ValueError('Random stride range should be >= 0, got {}'.format(
        random_stride_range))

  if input_image_format not in ('jpeg', 'png', 'none'):
    raise ValueError('Unknown input image format: {}'.format(
        input_image_format))

  if isinstance(crop_size, int):
    crop_size = (crop_size, crop_size)
  crop_height, crop_width = crop_size

  # Temporal sampler.
  if is_training:
    if random_stride_range > 0:
      # Uniformly sample different frame-rates
      stride = tf.random.uniform(
          [],
          tf.maximum(stride - random_stride_range, 1),
          stride + random_stride_range,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/vision/dataloaders/video_input.py:98 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/28e2cbbed9abf1fe. Report an issue: GitHub.