MCPcopy Create free account
hub / github.com/Topdu/OpenOCR / DropPath

Class DropPath

openrec/modeling/common.py:81–94  ·  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

79
80
81class 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
97class Identity(nn.Module):

Callers 15

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected