MCPcopy Create free account
hub / github.com/apple/ml-stable-diffusion / GEGLU

Class GEGLU

python_coreml_stable_diffusion/unet.py:602–610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600
601
602class GEGLU(nn.Module):
603
604 def __init__(self, dim_in, dim_out):
605 super().__init__()
606 self.proj = nn.Conv2d(dim_in, dim_out * 2, kernel_size=1)
607
608 def forward(self, hidden_states):
609 hidden_states, gate = self.proj(hidden_states).chunk(2, dim=1)
610 return hidden_states * F.gelu(gate)
611
612
613def get_activation(act_fn):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected