tensorflow/models · error · ValueError

Invalid summary type provided: %s

Error message

Invalid summary type provided: %s

What it means

Error "Invalid summary type provided: %s" thrown in tensorflow/models.

Source

Thrown at official/legacy/xlnet/xlnet_modeling.py:1043

    """Implements build() for the layer."""
    if self.use_proj:
      self.proj_layer = tf_keras.layers.Dense(
          units=self.hidden_size,
          kernel_initializer=self.initializer,
          activation=tf.nn.tanh,
          name="summary")
    self.dropout_layer = tf_keras.layers.Dropout(rate=self.dropout_rate)

    super(Summarization, self).build(unused_input_shapes)

  def call(self, inputs):
    """Implements call() for the layer."""
    if self.summary_type == "last":
      summary = inputs[:, -1, :]
    elif self.summary_type == "first":
      summary = inputs[:, 0, :]
    else:
      raise ValueError("Invalid summary type provided: %s" % self.summary_type)
    if self.use_proj:
      summary = self.proj_layer(summary)
    summary = self.dropout_layer(summary)
    return summary


class ClassificationLossLayer(tf_keras.layers.Layer):
  """Layer computing cross entropy loss for classification task."""

  def __init__(self, n_class, initializer, **kwargs):
    """Constructs Summarization layer.

    Args:
      n_class: Number of tokens in vocabulary.
      initializer: Initializer used for parameters.
      **kwargs: Other parameters.
    """
    super(ClassificationLossLayer, self).__init__(**kwargs)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/legacy/xlnet/xlnet_modeling.py:1043 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/12c1ac7b7f688781. Report an issue: GitHub.