Table of Contents
Shortcuts

# stochastic_depth

torchvision.ops.stochastic_depth(input: Tensor, p: float, mode: str, training: bool = True) → Tensor

  Implements the Stochastic Depth from “Deep Networks with Stochastic Depth” used for randomly dropping residual branches of residual architectures.

  Parameters:

    - input (Tensor[N, ...]) – The input tensor or arbitrary dimensions with the first one being its batch i.e. a batch with `N` rows.

    - p (float) – probability of the input to be zeroed.

    - mode (str) – `"batch"` or `"row"`. `"batch"` randomly zeroes the entire input, `"row"` zeroes randomly selected rows from the batch.

    - training – apply stochastic depth if is `True`. Default: `True`

  Returns:

    The randomly zeroed tensor.

  Return type:

    Tensor[N, …]

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.