MCPcopy Create free account
hub / github.com/TencentARC/MotionCtrl / __init__

Method __init__

lvdm/modules/networks/ae_modules.py:620–651  ·  view source on GitHub ↗
(self, in_channels, out_channels, ch, num_res_blocks, resolution,
                 ch_mult=(2,2), dropout=0.0)

Source from the content-addressed store, hash-verified

618
619class UpsampleDecoder(nn.Module):
620 def __init__(self, in_channels, out_channels, ch, num_res_blocks, resolution,
621 ch_mult=(2,2), dropout=0.0):
622 super().__init__()
623 # upsampling
624 self.temb_ch = 0
625 self.num_resolutions = len(ch_mult)
626 self.num_res_blocks = num_res_blocks
627 block_in = in_channels
628 curr_res = resolution // 2 ** (self.num_resolutions - 1)
629 self.res_blocks = nn.ModuleList()
630 self.upsample_blocks = nn.ModuleList()
631 for i_level in range(self.num_resolutions):
632 res_block = []
633 block_out = ch * ch_mult[i_level]
634 for i_block in range(self.num_res_blocks + 1):
635 res_block.append(ResnetBlock(in_channels=block_in,
636 out_channels=block_out,
637 temb_channels=self.temb_ch,
638 dropout=dropout))
639 block_in = block_out
640 self.res_blocks.append(nn.ModuleList(res_block))
641 if i_level != self.num_resolutions - 1:
642 self.upsample_blocks.append(Upsample(block_in, True))
643 curr_res = curr_res * 2
644
645 # end
646 self.norm_out = Normalize(block_in)
647 self.conv_out = torch.nn.Conv2d(block_in,
648 out_channels,
649 kernel_size=3,
650 stride=1,
651 padding=1)
652
653 def forward(self, x):
654 # upsampling

Callers

nothing calls this directly

Calls 4

ResnetBlockClass · 0.70
UpsampleClass · 0.70
NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected