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

Method forward

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

Source from the content-addressed store, hash-verified

553 nn.init.zeros_(self.conv4[-1].bias)
554
555 def forward(self, hidden_states: torch.Tensor, num_frames: int = 1) -> torch.Tensor:
556 hidden_states = (
557 hidden_states[None, :].reshape((-1, num_frames) + hidden_states.shape[1:]).permute(0, 2, 1, 3, 4)
558 )
559
560 identity = hidden_states
561 hidden_states = self.conv1(hidden_states)
562 hidden_states = self.conv2(hidden_states)
563 hidden_states = self.conv3(hidden_states)
564 hidden_states = self.conv4(hidden_states)
565
566 hidden_states = identity + hidden_states
567
568 hidden_states = hidden_states.permute(0, 2, 1, 3, 4).reshape(
569 (hidden_states.shape[0] * hidden_states.shape[2], -1) + hidden_states.shape[3:]
570 )
571 return hidden_states
572
573
574class TemporalResnetBlock(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected