MCPcopy Create free account
hub / github.com/CompVis/zigma / DropPath

Class DropPath

model_zigma.py:162–174  ·  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

160
161
162class DropPath(nn.Module):
163 """Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
164
165 def __init__(self, drop_prob: float = 0.0, scale_by_keep: bool = True):
166 super(DropPath, self).__init__()
167 self.drop_prob = drop_prob
168 self.scale_by_keep = scale_by_keep
169
170 def forward(self, x):
171 return drop_path(x, self.drop_prob, self.training, self.scale_by_keep)
172
173 def extra_repr(self):
174 return f"drop_prob={round(self.drop_prob,3):0.3f}"
175
176
177class CaptionEmbedder(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected