tensorflow/models · error · ValueError
Fractional pooling is only supported for `pool_type`=`trunca
Error message
Fractional pooling is only supported for `pool_type`=`truncated_average`
What it means
Error "Fractional pooling is only supported for `pool_type`=`truncated_average`" thrown in tensorflow/models.
Source
Thrown at official/nlp/modeling/networks/funnel_transformer.py:393
self._pooler_layer = tf_keras.layers.Dense(
units=hidden_size,
activation='tanh',
kernel_initializer=tf_utils.clone_initializer(initializer),
name='pooler_transform')
if isinstance(pool_stride, int):
# TODO(b/197133196): Pooling layer can be shared.
pool_strides = [pool_stride] * num_layers
else:
if len(pool_stride) != num_layers:
raise ValueError('Lengths of pool_stride and num_layers are not equal.')
pool_strides = pool_stride
is_fractional_pooling = False in [
(1.0 * pool_stride).is_integer() for pool_stride in pool_strides
]
if is_fractional_pooling and pool_type in [_MAX, _AVG]:
raise ValueError(
'Fractional pooling is only supported for'
' `pool_type`=`truncated_average`'
)
# TODO(crickwu): explore tf_keras.layers.serialize method.
if pool_type == _MAX:
pool_cls = tf_keras.layers.MaxPooling1D
elif pool_type == _AVG:
pool_cls = tf_keras.layers.AveragePooling1D
elif pool_type == _TRUNCATED_AVG:
# TODO(b/203665205): unpool_length should be implemented.
if unpool_length != 0:
raise ValueError('unpool_length is not supported by truncated_avg now.')
else:
raise ValueError('pool_type not supported.')
if pool_type in (_MAX, _AVG):
self._att_input_pool_layers = []View on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/nlp/modeling/networks/funnel_transformer.py:393 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/30e69d3a4a176850.
Report an issue: GitHub.