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

Method forward

diffusers/src/diffusers/models/resnet.py:608–631  ·  view source on GitHub ↗
(self, input_tensor: torch.Tensor, temb: torch.Tensor)

Source from the content-addressed store, hash-verified

606 )
607
608 def forward(self, input_tensor: torch.Tensor, temb: torch.Tensor) -> torch.Tensor:
609 hidden_states = input_tensor
610
611 hidden_states = self.norm1(hidden_states)
612 hidden_states = self.nonlinearity(hidden_states)
613 hidden_states = self.conv1(hidden_states)
614
615 if self.time_emb_proj is not None:
616 temb = self.nonlinearity(temb)
617 temb = self.time_emb_proj(temb)[:, :, :, None, None]
618 temb = temb.permute(0, 2, 1, 3, 4)
619 hidden_states = hidden_states + temb
620
621 hidden_states = self.norm2(hidden_states)
622 hidden_states = self.nonlinearity(hidden_states)
623 hidden_states = self.dropout(hidden_states)
624 hidden_states = self.conv2(hidden_states)
625
626 if self.conv_shortcut is not None:
627 input_tensor = self.conv_shortcut(input_tensor)
628
629 output_tensor = input_tensor + hidden_states
630
631 return output_tensor
632
633
634# VideoResBlock

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected