tensorflow/models · error · ValueError

sample_from_segments is set to True while got num_test_clips

Error message

sample_from_segments is set to True while got num_test_clips: %d

What it means

Error "sample_from_segments is set to True while got num_test_clips: %d" thrown in tensorflow/models.

Source

Thrown at official/projects/videoglue/datasets/common/utils.py:293

    sync_random_state: Whether to use stateful option to keep random operations
      in sync between different modalities. All modalities having this option
      True will use the same outcome in random operations such as sampling and
      cropping.
    seed: the random seed.
  """
  # Validate parameters.
  if sync_random_state and multi_crop:
    raise ValueError('multi_crop is not supported with sync random states.')

  if augmentation_type.lower() == 'ava' and multi_crop:
    raise ValueError('multi_crop should not be combined with ava augmentation.')

  if sample_from_segments and sample_around_keyframe:
    raise ValueError('sample_from_segments and sample_around_keyframes cannot '
                     'be True at the same time.')

  if sample_from_segments and num_test_clips > 1:
    raise ValueError(
        'sample_from_segments is set to True while got num_test_clips: %d'
        % num_test_clips
    )

  # Parse frames.
  if isinstance(parser_builder, builders.SequenceExampleParserBuilder):
    parser_builder.parse_feature(
        feature_name=input_feature_name,
        feature_type=tf.io.FixedLenSequenceFeature((), dtype=tf.string),
        output_name=output_feature_name)
  elif isinstance(parser_builder, builders.ExampleParserBuilder):
    parser_builder.parse_feature(
        feature_name=input_feature_name,
        feature_type=tf.io.FixedLenFeature((), dtype=tf.string),
        output_name=output_feature_name)
    sampler_builder.add_fn(
        fn=lambda x: tf.expand_dims(x, axis=0),
        feature_name=output_feature_name,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/videoglue/datasets/common/utils.py:293 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/4642052cb474d89b. Report an issue: GitHub.