tensorflow/models · error · ValueError
Unrecognized pooling method
Error message
Unrecognized pooling method: %s
What it means
Raised in frame_pooling when the pooling method string is not one of the supported ones (e.g. 'mean', 'max', ...). It is the dispatch guard of the frame-pooling utility.
Solutions
- Set method to one of the supported pooling methods ('max', 'swap', etc. per the if/elif chain in frame_pooling)
- Check for typos or trailing whitespace in the method string from your config
- If you need a new pooling method, extend the elif chain in frame_pooling with a branch for it
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/yt8m/modeling/yt8m_model_utils.py:135 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/58484fe820e28a18.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/yt8m/modeling/yt8m_model_utils.py:135
frames = tf.where(
frame_mask,
frames,
tf.ones_like(frames, dtype=frames.dtype)
* _large_compatible_negative(frames.dtype),
)
# Magic to avoid loss NaN when bfloat16 is enabled.
# See yaqs/5377152819545505792 and b/214396297 for more discussion.
reduced = tf.reduce_max(frames, 1) + tf.reduce_mean(frames, 1) * 0
elif method == "swap":
# Note we assume the frames are in the shape of
# [batch_size, num_frames, feature_size]. Otherwise this function might
# fail.
reduced = frame_swap(frames, frame_mask)
elif method == "none":
feature_size = frames.shape.as_list()[2]
reduced = tf.reshape(frames, [-1, feature_size])
else:
raise ValueError("Unrecognized pooling method: %s" % method)
return reduced
View on GitHub (pinned to e006f5f0d5)