Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
| 19 | |
| 20 | |
| 21 | class DropPath(nn.Module): |
| 22 | """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).""" |
| 23 | |
| 24 | def __init__(self, drop_prob=None): |
| 25 | super(DropPath, self).__init__() |
| 26 | self.drop_prob = drop_prob |
| 27 | |
| 28 | def forward(self, x): |
| 29 | return drop_path(x, self.drop_prob, self.training) |