tensorflow/models · error · ValueError
Expected features is a rank-5 tensor. Got shape %s
Error message
Expected features is a rank-5 tensor. Got shape %s
What it means
Error "Expected features is a rank-5 tensor. Got shape %s" thrown in tensorflow/models.
Source
Thrown at official/projects/const_cl/modeling/heads/instance_reconstructor.py:173
return tf.concat([inputs, temporal_position, spatial_position], axis=-1)
def _keyframe_roi_pooling(self,
features: tf.Tensor,
boxes: tf.Tensor,
training: bool = True) -> tf.Tensor:
"""Pools ROI features on the keyframe.
Args:
features: a 5D tensor in shape [B, T, H, W, C].
boxes: normalized box coordinates, a 4D tensor in shape [B, T', N, 4].
training: whether in training mode.
Returns:
roi_feature: pooled ROI-features in shape [B, N, C].
"""
if features.shape.ndims != 5:
raise ValueError('Expected features is a rank-5 tensor. Got shape %s' %
features.shape)
keyframe_index = tf.shape(boxes)[1] // 2
t, h, w = _get_shape(features)[1:4]
roi_features = {'0': features[:, t // 2, ...]}
keyframe_boxes = boxes[:, keyframe_index, ...]
unnormalized_boxes = keyframe_boxes * tf.convert_to_tensor(
[h, w, h, w], keyframe_boxes.dtype)
# roi_features in shape [B, N, h, w, C]
roi_features = self._roi_aligner(
roi_features, unnormalized_boxes, training=training)
roi_shape = _get_shape(roi_features)
# Perform average_pooling on ROI-pooled features.
roi_features = tf.reshape(roi_features, [-1] + roi_shape[2:])
roi_features = tf.reduce_mean(roi_features, axis=[1, 2])
roi_features = tf.reshape(roi_features, roi_shape[:2] + roi_shape[-1:])
return roi_featuresView on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/const_cl/modeling/heads/instance_reconstructor.py:173 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/dc8984c49dfdf37a.
Report an issue: GitHub.