Shortcuts

stochastic_depth

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

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