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

Method forward

src/diffusers/models/resnet.py:640–663  ·  view source on GitHub ↗
(self, input_tensor: torch.FloatTensor, temb: torch.FloatTensor)

Source from the content-addressed store, hash-verified

638 )
639
640 def forward(self, input_tensor: torch.FloatTensor, temb: torch.FloatTensor) -> torch.FloatTensor:
641 hidden_states = input_tensor
642
643 hidden_states = self.norm1(hidden_states)
644 hidden_states = self.nonlinearity(hidden_states)
645 hidden_states = self.conv1(hidden_states)
646
647 if self.time_emb_proj is not None:
648 temb = self.nonlinearity(temb)
649 temb = self.time_emb_proj(temb)[:, :, :, None, None]
650 temb = temb.permute(0, 2, 1, 3, 4)
651 hidden_states = hidden_states + temb
652
653 hidden_states = self.norm2(hidden_states)
654 hidden_states = self.nonlinearity(hidden_states)
655 hidden_states = self.dropout(hidden_states)
656 hidden_states = self.conv2(hidden_states)
657
658 if self.conv_shortcut is not None:
659 input_tensor = self.conv_shortcut(input_tensor)
660
661 output_tensor = input_tensor + hidden_states
662
663 return output_tensor
664
665
666# VideoResBlock

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected