MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / forward

Method forward

diffusers/src/diffusers/models/normalization.py:425–438  ·  view source on GitHub ↗
(self, hidden_states)

Source from the content-addressed store, hash-verified

423 self.weight = None
424
425 def forward(self, hidden_states):
426 input_dtype = hidden_states.dtype
427 variance = hidden_states.to(torch.float32).pow(2).mean(-1, keepdim=True)
428 hidden_states = hidden_states * torch.rsqrt(variance + self.eps)
429
430 if self.weight is not None:
431 # convert into half-precision if necessary
432 if self.weight.dtype in [torch.float16, torch.bfloat16]:
433 hidden_states = hidden_states.to(self.weight.dtype)
434 hidden_states = hidden_states * self.weight
435 else:
436 hidden_states = hidden_states.to(input_dtype)
437
438 return hidden_states
439
440
441class GlobalResponseNorm(nn.Module):

Callers

nothing calls this directly

Calls 1

toMethod · 0.45

Tested by

no test coverage detected