Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
| 89 | |
| 90 | |
| 91 | class DropPath(nn.Module): |
| 92 | """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). |
| 93 | """ |
| 94 | def __init__(self, drop_prob=None): |
| 95 | super(DropPath, self).__init__() |
| 96 | self.drop_prob = drop_prob |
| 97 | |
| 98 | def forward(self, x): |
| 99 | return drop_path(x, self.drop_prob, self.training) |
| 100 | |
| 101 | |
| 102 | to_1tuple = _ntuple(1) |