Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
| 26 | |
| 27 | |
| 28 | class DropPath(nn.Module): |
| 29 | """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). |
| 30 | """ |
| 31 | |
| 32 | def __init__(self, drop_prob=None): |
| 33 | super(DropPath, self).__init__() |
| 34 | self.drop_prob = drop_prob |
| 35 | |
| 36 | def forward(self, x): |
| 37 | return drop_path(x, self.drop_prob, self.training) |
| 38 | |
| 39 | def extra_repr(self): |
| 40 | return 'p={}'.format(self.drop_prob) |
| 41 | |
| 42 | |
| 43 | class Mlp(nn.Module): |