tensorflow/models · error · NotImplementedError

rel_attn_type {self.rel_attn_type} not implemented yet.

Error message

rel_attn_type {self.rel_attn_type} not implemented yet.

What it means

Error "rel_attn_type {self.rel_attn_type} not implemented yet." thrown in tensorflow/models.

Source

Thrown at official/projects/maxvit/modeling/layers.py:230

        raise ValueError(
            'Does not support relative attention for query shape: %s.'
            % query_shape_list
        )

      if self.scale_ratio is not None:
        scale_ratio = eval(self.scale_ratio)  # pylint:disable=eval-used  # pyrefly: ignore[bad-argument-type]
        vocab_height = 2 * int(height / scale_ratio) - 1
        vocab_width = 2 * int(width / scale_ratio) - 1
      else:
        vocab_height = 2 * height - 1
        vocab_width = 2 * width - 1

      if self.rel_attn_type == '2d_multi_head':
        rel_bias_shape = [self.num_heads, vocab_height, vocab_width]
      elif self.rel_attn_type == '2d_single_head':
        rel_bias_shape = [vocab_height, vocab_width]
      else:
        raise NotImplementedError(
            f'rel_attn_type {self.rel_attn_type} not implemented yet.'
        )

      self._feat_height = height
      self._feat_width = width
      self.relative_bias = self.add_weight(
          'relative_bias',
          rel_bias_shape,
          initializer=self.kernel_initializer,
          trainable=True,
      )

  def call(
      self,
      query: tf.Tensor,
      training: bool,
      context: Optional[tf.Tensor] = None,
      attn_mask: Optional[tf.Tensor] = None,

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/maxvit/modeling/layers.py:230 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/21651c6c2ba51b54. Report an issue: GitHub.