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

Method forward

python_coreml_stable_diffusion/unet.py:463–482  ·  view source on GitHub ↗
(self, x, temb)

Source from the content-addressed store, hash-verified

461 padding=0)
462
463 def forward(self, x, temb):
464 hidden_states = x
465 hidden_states = self.norm1(hidden_states)
466 hidden_states = self.nonlinearity(hidden_states)
467 hidden_states = self.conv1(hidden_states)
468
469 if temb is not None:
470 temb = self.time_emb_proj(self.nonlinearity(temb))
471 hidden_states = hidden_states + temb
472
473 hidden_states = self.norm2(hidden_states)
474 hidden_states = self.nonlinearity(hidden_states)
475 hidden_states = self.conv2(hidden_states)
476
477 if self.conv_shortcut is not None:
478 x = self.conv_shortcut(x)
479
480 out = (x + hidden_states)
481
482 return out
483
484
485class Upsample2D(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected