MCPcopy Create free account
hub / github.com/OpenGVLab/UniFormerV2 / LayerNorm

Class LayerNorm

extract_clip/model.py:157–163  ·  view source on GitHub ↗

Subclass torch's LayerNorm to handle fp16.

Source from the content-addressed store, hash-verified

155
156
157class LayerNorm(nn.LayerNorm):
158 """Subclass torch's LayerNorm to handle fp16."""
159
160 def forward(self, x: torch.Tensor):
161 orig_type = x.dtype
162 ret = super().forward(x.type(torch.float32))
163 return ret.type(orig_type)
164
165
166class QuickGELU(nn.Module):

Callers 3

__init__Method · 0.70
__init__Method · 0.70
__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected