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

Method forward

diffusers/src/diffusers/models/resnet.py:523–539  ·  view source on GitHub ↗
(self, hidden_states: torch.Tensor, num_frames: int = 1)

Source from the content-addressed store, hash-verified

521 nn.init.zeros_(self.conv4[-1].bias)
522
523 def forward(self, hidden_states: torch.Tensor, num_frames: int = 1) -> torch.Tensor:
524 hidden_states = (
525 hidden_states[None, :].reshape((-1, num_frames) + hidden_states.shape[1:]).permute(0, 2, 1, 3, 4)
526 )
527
528 identity = hidden_states
529 hidden_states = self.conv1(hidden_states)
530 hidden_states = self.conv2(hidden_states)
531 hidden_states = self.conv3(hidden_states)
532 hidden_states = self.conv4(hidden_states)
533
534 hidden_states = identity + hidden_states
535
536 hidden_states = hidden_states.permute(0, 2, 1, 3, 4).reshape(
537 (hidden_states.shape[0] * hidden_states.shape[2], -1) + hidden_states.shape[3:]
538 )
539 return hidden_states
540
541
542class TemporalResnetBlock(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected