{"record":{"id":"9c420f6b06997bf6","repo":"tensorflow/models","slug":"keyframe-index-key-is-not-found-in-input-diction","errorCode":null,"errorMessage":"{keyframe_index_key} is not found in input dictionary.","messagePattern":"(.+?) is not found in input dictionary\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/videoglue/datasets/common/processors.py","lineNumber":682,"sourceCode":"    sample_target_key: str = 'image',\n    keyframe_index_key: str = 'keyframe_index'\n) -> MutableMapping[str, tf.Tensor]:\n  \"\"\"Samples a single segment around keyframe from a given sequence.\n\n  Args:\n    inputs: dict with sample_target and keyframe_index features.\n    num_steps: Number of steps (e.g. frames) to take.\n    stride: the stride of sampling.\n    sample_target_key: the key for the sample target.\n    keyframe_index_key: the key for the keyframe index.\n\n  Returns:\n    Modified inputs with sampled target.\n  \"\"\"\n  if sample_target_key not in inputs:\n    raise ValueError(f'{sample_target_key} is not found in input dictionary.')\n  if keyframe_index_key not in inputs:\n    raise ValueError(f'{keyframe_index_key} is not found in input dictionary.')\n\n  sequence = inputs[sample_target_key]\n\n  keyframe_index = tf.cast(inputs[keyframe_index_key], dtype=tf.int32)\n  keyframe_index = tf.squeeze(keyframe_index)  # assuming there's a single one\n\n  sequence_length = tf.shape(sequence)[0]\n  sequence_length = tf.cast(sequence_length, tf.int32)\n\n  early = keyframe_index - (num_steps * stride) // 2\n  late = keyframe_index + (num_steps * stride) // 2\n  offset = tf.maximum(0, early)\n\n  pad_before = tf.maximum(0, -early)\n  pad_after = tf.maximum(0, late - sequence_length)\n\n  # Repeat first and last frames appropriately.\n  repeat = sequence.shape.ndims - 1","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/videoglue/datasets/common/processors.py#L664-L700","documentation":"Error \"{keyframe_index_key} is not found in input dictionary.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/videoglue/datasets/common/processors.py:682 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}