MCPcopy Create free account
hub / github.com/FoundationVision/LlamaGen / DropPath

Class DropPath

utils/drop_path.py:24–36  ·  view source on GitHub ↗

Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).

Source from the content-addressed store, hash-verified

22
23
24class DropPath(torch.nn.Module):
25 """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).
26 """
27 def __init__(self, drop_prob: float = 0., scale_by_keep: bool = True):
28 super(DropPath, self).__init__()
29 self.drop_prob = drop_prob
30 self.scale_by_keep = scale_by_keep
31
32 def forward(self, x):
33 return drop_path(x, self.drop_prob, self.training, self.scale_by_keep)
34
35 def extra_repr(self):
36 return f'drop_prob={round(self.drop_prob,3):0.3f}'

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected