MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / forward

Method forward

src/diffusers/models/attention.py:588–614  ·  view source on GitHub ↗
(self, hidden_states, encoder_hidden_states, cross_attention_kwargs)

Source from the content-addressed store, hash-verified

586 )
587
588 def forward(self, hidden_states, encoder_hidden_states, cross_attention_kwargs):
589 cross_attention_kwargs = cross_attention_kwargs.copy() if cross_attention_kwargs is not None else {}
590
591 if self.kv_mapper is not None:
592 encoder_hidden_states = self.kv_mapper(F.silu(encoder_hidden_states))
593
594 norm_hidden_states = self.norm1(hidden_states)
595
596 attn_output = self.attn1(
597 norm_hidden_states,
598 encoder_hidden_states=encoder_hidden_states,
599 **cross_attention_kwargs,
600 )
601
602 hidden_states = attn_output + hidden_states
603
604 norm_hidden_states = self.norm2(hidden_states)
605
606 attn_output = self.attn2(
607 norm_hidden_states,
608 encoder_hidden_states=encoder_hidden_states,
609 **cross_attention_kwargs,
610 )
611
612 hidden_states = attn_output + hidden_states
613
614 return hidden_states
615
616
617class FeedForward(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected