espnet2.asr.state_spaces.components.stochastic_depth
Less than 1 minute
espnet2.asr.state_spaces.components.stochastic_depth
espnet2.asr.state_spaces.components.stochastic_depth(input: tensor, p: float, mode: str, training: bool = True)
Apply stochastic depth.
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
Nrows. - 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
- input (Tensor *[*N , ... ]) – The input tensor or arbitrary dimensions with the first one being its batch i.e. a batch with
- Returns: The randomly zeroed tensor.
- Return type: Tensor[N, …]
