{"record":{"id":"dc8984c49dfdf37a","repo":"tensorflow/models","slug":"expected-features-is-a-rank-5-tensor-got-shape-s","errorCode":null,"errorMessage":"Expected features is a rank-5 tensor. Got shape %s","messagePattern":"Expected features is a rank-5 tensor\\. Got shape (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"official/projects/const_cl/modeling/heads/instance_reconstructor.py","lineNumber":173,"sourceCode":"\n    return tf.concat([inputs, temporal_position, spatial_position], axis=-1)\n\n  def _keyframe_roi_pooling(self,\n                            features: tf.Tensor,\n                            boxes: tf.Tensor,\n                            training: bool = True) -> tf.Tensor:\n    \"\"\"Pools ROI features on the keyframe.\n\n    Args:\n      features: a 5D tensor in shape [B, T, H, W, C].\n      boxes: normalized box coordinates, a 4D tensor in shape [B, T', N, 4].\n      training: whether in training mode.\n\n    Returns:\n      roi_feature: pooled ROI-features in shape [B, N, C].\n    \"\"\"\n    if features.shape.ndims != 5:\n      raise ValueError('Expected features is a rank-5 tensor. Got shape %s' %\n                       features.shape)\n\n    keyframe_index = tf.shape(boxes)[1] // 2\n    t, h, w = _get_shape(features)[1:4]\n    roi_features = {'0': features[:, t // 2, ...]}\n    keyframe_boxes = boxes[:, keyframe_index, ...]\n    unnormalized_boxes = keyframe_boxes * tf.convert_to_tensor(\n        [h, w, h, w], keyframe_boxes.dtype)\n    # roi_features in shape [B, N, h, w, C]\n    roi_features = self._roi_aligner(\n        roi_features, unnormalized_boxes, training=training)\n\n    roi_shape = _get_shape(roi_features)\n    # Perform average_pooling on ROI-pooled features.\n    roi_features = tf.reshape(roi_features, [-1] + roi_shape[2:])\n    roi_features = tf.reduce_mean(roi_features, axis=[1, 2])\n    roi_features = tf.reshape(roi_features, roi_shape[:2] + roi_shape[-1:])\n    return roi_features","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/projects/const_cl/modeling/heads/instance_reconstructor.py#L155-L191","documentation":"Error \"Expected features is a rank-5 tensor. Got shape %s\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/projects/const_cl/modeling/heads/instance_reconstructor.py:173 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"}