Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
| 79 | |
| 80 | |
| 81 | class DropPath(nn.Module): |
| 82 | """Drop paths (Stochastic Depth) per sample (when applied in main path of |
| 83 | residual blocks).""" |
| 84 | |
| 85 | def __init__(self, drop_prob: float = 0.0, scale_by_keep: bool = True): |
| 86 | super(DropPath, self).__init__() |
| 87 | self.drop_prob = drop_prob |
| 88 | self.scale_by_keep = scale_by_keep |
| 89 | |
| 90 | def forward(self, x): |
| 91 | return drop_path(x, self.drop_prob, self.training, self.scale_by_keep) |
| 92 | |
| 93 | def extra_repr(self): |
| 94 | return f'drop_prob={round(self.drop_prob,3):0.3f}' |
| 95 | |
| 96 | |
| 97 | class Identity(nn.Module): |
no outgoing calls
no test coverage detected