tensorflow/models · error · ValueError

unpool_length is not supported by truncated_avg now.

Error message

unpool_length is not supported by truncated_avg now.

What it means

Error "unpool_length is not supported by truncated_avg now." thrown in tensorflow/models.

Source

Thrown at official/nlp/modeling/networks/funnel_transformer.py:406

    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 = []
      for layer_pool_stride in pool_strides:
        att_input_pool_layer = pool_cls(  # pyrefly: ignore[unbound-name]
            pool_size=layer_pool_stride,
            strides=layer_pool_stride,
            padding='same',
            name='att_input_pool_layer')
        self._att_input_pool_layers.append(att_input_pool_layer)

    self._max_sequence_length = max_sequence_length
    self._pool_strides = pool_strides  # This is a list here.
    self._unpool_length = unpool_length
    self._pool_type = pool_type
    self._append_dense_inputs = append_dense_inputs

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/nlp/modeling/networks/funnel_transformer.py:406 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/cb5cb55b8d4a91be. Report an issue: GitHub.