tensorflow/models · error · ValueError
sample_random and sample_around_keyframe cannot be both True
Error message
sample_random and sample_around_keyframe cannot be both True.
What it means
Error "sample_random and sample_around_keyframe cannot be both True." thrown in tensorflow/models.
Source
Thrown at official/projects/videoglue/datasets/common/utils.py:1024
sync_random_state: bool = True):
"""Adds functions to process label feature to builders.
Args:
parser_builder: An instance of a builders.BaseParserBuilder.
sampler_builder: An instance of a builders.SamplerBuilder.
preprocessor_builder: An instance of a builders.PreprocessorBuilder.
input_box_dim_name: The input feature name.
output_box_dim_name: The output feature name.
sample_around_keyframe: Whether to sample the sequence around the keyframe.
If True, it requires keyframe id is known.
sample_random: Whether to perform random sampling.
num_instances_per_frame: The number of instances per frame.
num_frames: The number of frames to sample.
temporal_stride: The temopral sampling stride.
sync_random_state: Whether to sync the random state.
"""
if sample_random and sample_around_keyframe:
raise ValueError(
'sample_random and sample_around_keyframe cannot be both True.')
# Parse box dim.
parser_builder.parse_feature(
feature_name=input_box_dim_name,
# Entire signal stored in one Feature.
feature_type=tf.io.VarLenFeature(dtype=tf.float32),
output_name=output_box_dim_name)
sampler_builder.add_fn(
fn=tf.sparse.to_dense,
feature_name=output_box_dim_name,
fn_name='{}_sparse_to_dense'.format(output_box_dim_name))
# Temporal sampler.
if sample_random:
# Sample random clip.
def sample_sequence_fn(x, state=None):View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/videoglue/datasets/common/utils.py:1024 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/5b8b5b4b5ff153b2.
Report an issue: GitHub.