vis4d.op.layer.drop¶
DropPath (Stochastic Depth) regularization layers.
Modified from timm (https://github.com/huggingface/pytorch-image-models).
Functions
|
Drop path regularizer (Stochastic Depth) per sample. |
Classes
|
DropPath regularizer (Stochastic Depth) per sample. |
- class DropPath(drop_prob=0.0, scale_by_keep=True)[source]¶
DropPath regularizer (Stochastic Depth) per sample.
Init DropPath.
- Parameters:
drop_prob (float, optional) – Probability of an item to be masked. Defaults to 0.0.
scale_by_keep (bool, optional) – If to scale by keep probability. Defaults to True.
- drop_path(x, drop_prob=0.0, training=False, scale_by_keep=True)[source]¶
Drop path regularizer (Stochastic Depth) per sample.
- Parameters:
x (torch.Tensor) – Input tensor of shape (batch_size, …).
drop_prob (float, optional) – Probability of an element to be zeroed. Defaults to 0.0.
training (bool, optional) – If to apply drop path. Defaults to False.
scale_by_keep (bool, optional) – If to scale by keep probability. Defaults to True.
- Return type:
Tensor