tensorflow/models · error · ValueError

drop_rate {} is outside [0, 1)

Error message

drop_rate {} is outside [0, 1)

What it means

Error "drop_rate {} is outside [0, 1)" thrown in tensorflow/models.

Source

Thrown at official/projects/pix2seq/modeling/transformer.py:181

    }
    config.update(updates)
    return config


def suffix_id(i):
  """Return suffix id for layer/variable name."""
  return '' if i == 0 else '_%d' % i


class DropPath(tf_keras.layers.Layer):
  """For stochastic depth."""

  def __init__(self, drop_rate=0.0, **kwargs):
    """Initializes a drop path layer."""
    super().__init__(**kwargs)
    self._drop_rate = drop_rate
    if self._drop_rate < 0 or self._drop_rate >= 1.0:
      raise ValueError('drop_rate {} is outside [0, 1)'.format(self._drop_rate))

  def call(self, x, training=False):
    """Performs a forward pass.

    Args:
      x: An input tensor of type tf.Tensor with shape [batch, height, width,
        channels].
      training: A boolean flag indicating whether training behavior should be
        used (default: False).

    Returns:
      The output tensor.
    """
    if self._drop_rate == 0.0 or not training:
      return x

    keep_rate = 1.0 - self._drop_rate
    xshape = tf.shape(x)

View on GitHub (pinned to e006f5f0d5)

When it happens

Trigger: Thrown at official/projects/pix2seq/modeling/transformer.py:181 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/f21625c3a8d3fc2a. Report an issue: GitHub.