DropPath layer

[source]

DropPath class

keras_cv.layers.DropPath(rate=0.5, seed=None, **kwargs)

Implements the DropPath layer. DropPath randomly drops samples during training with a probability of rate. Note that this layer drops individual samples within a batch and not the entire batch. DropPath randomly drops some individual samples from a batch, whereas StochasticDepth randomly drops the entire batch.

References

Arguments

  • rate: float, the probability of the residual branch being dropped.
  • seed: (Optional) integer. Used to create a random seed.

Example

DropPath can be used in any network as follows:

# (...)
input = tf.ones((1, 3, 3, 1), dtype=tf.float32)
residual = keras.layers.Conv2D(1, 1)(input)
output = keras_cv.layers.DropPath()(input)
# (...)