dropouts
Dropout layers: stochastic depth (DropPath) and the create_dropout factory.
Classes:
-
DropPathβDrop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
Functions:
-
drop_pathβDrop paths (Stochastic Depth) per sample (when applied in main path of residual blocks),
-
create_dropoutβResolve a dropout layer from a name, a class, an instance, or a probability, returning
Noneforname=None.
DropPath [source] ΒΆ
Bases: Module
Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
drop_path [source] ΒΆ
drop_path(
x: Tensor,
drop_prob: float = 0.0,
training: bool = False,
scale_by_keep: bool = True,
) -> Tensor
Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks), as described in the paper Deep Networks with Stochastic Depth by Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, Kilian Weinberger.
Implementation is taken from original implementation by Ross Wightman in pytorch-image-models.
create_dropout [source] ΒΆ
create_dropout(
name: Union[DropoutLike, float, None],
*args: Any,
**kwargs: Any,
) -> Optional[Module]
Resolve a dropout layer from a name, a class, an instance, or a probability, returning None for name=None.
Parameters:
-
name(Union[DropoutLike, float, None]) βDropout name (e.g.,
"dropout","drop_path"), a class, an instance, a float probability, which is a shorthand fornn.Dropout(p=name), orNone. -
*args(Any, default:()) βForwarded to the dropout constructor.
-
**kwargs(Any, default:{}) βForwarded to the dropout constructor (ignored if
nameis already an instance).
Returns:
-
Optional[Module]βThe instantiated dropout module, or
Noneifname is None.