Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
| 12 | __all__ = ['LadderSideAttentionFPN', 'ResidualLadderSideAttentionFPN'] |
| 13 | |
| 14 | class DropPath(nn.Module): |
| 15 | """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks). |
| 16 | """ |
| 17 | |
| 18 | def __init__(self, drop_prob=None): |
| 19 | super(DropPath, self).__init__() |
| 20 | self.drop_prob = drop_prob |
| 21 | |
| 22 | def forward(self, x): |
| 23 | return drop_path(x, self.drop_prob, self.training) |
| 24 | |
| 25 | def extra_repr(self): |
| 26 | return 'p={}'.format(self.drop_prob) |
| 27 | |
| 28 | |
| 29 | class Attention(nn.Module): |