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

Method forward

diffusers/src/diffusers/models/resnet.py:686–716  ·  view source on GitHub ↗
(
        self,
        hidden_states: torch.Tensor,
        temb: Optional[torch.Tensor] = None,
        image_only_indicator: Optional[torch.Tensor] = None,
    )

Source from the content-addressed store, hash-verified

684 )
685
686 def forward(
687 self,
688 hidden_states: torch.Tensor,
689 temb: Optional[torch.Tensor] = None,
690 image_only_indicator: Optional[torch.Tensor] = None,
691 ):
692 num_frames = image_only_indicator.shape[-1]
693 hidden_states = self.spatial_res_block(hidden_states, temb)
694
695 batch_frames, channels, height, width = hidden_states.shape
696 batch_size = batch_frames // num_frames
697
698 hidden_states_mix = (
699 hidden_states[None, :].reshape(batch_size, num_frames, channels, height, width).permute(0, 2, 1, 3, 4)
700 )
701 hidden_states = (
702 hidden_states[None, :].reshape(batch_size, num_frames, channels, height, width).permute(0, 2, 1, 3, 4)
703 )
704
705 if temb is not None:
706 temb = temb.reshape(batch_size, num_frames, -1)
707
708 hidden_states = self.temporal_res_block(hidden_states, temb)
709 hidden_states = self.time_mixer(
710 x_spatial=hidden_states_mix,
711 x_temporal=hidden_states,
712 image_only_indicator=image_only_indicator,
713 )
714
715 hidden_states = hidden_states.permute(0, 2, 1, 3, 4).reshape(batch_frames, channels, height, width)
716 return hidden_states
717
718
719class AlphaBlender(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected