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

Class SimpleDecoder

lvdm/modules/networks/ae_modules.py:583–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

581
582
583class SimpleDecoder(nn.Module):
584 def __init__(self, in_channels, out_channels, *args, **kwargs):
585 super().__init__()
586 self.model = nn.ModuleList([nn.Conv2d(in_channels, in_channels, 1),
587 ResnetBlock(in_channels=in_channels,
588 out_channels=2 * in_channels,
589 temb_channels=0, dropout=0.0),
590 ResnetBlock(in_channels=2 * in_channels,
591 out_channels=4 * in_channels,
592 temb_channels=0, dropout=0.0),
593 ResnetBlock(in_channels=4 * in_channels,
594 out_channels=2 * in_channels,
595 temb_channels=0, dropout=0.0),
596 nn.Conv2d(2*in_channels, in_channels, 1),
597 Upsample(in_channels, with_conv=True)])
598 # end
599 self.norm_out = Normalize(in_channels)
600 self.conv_out = torch.nn.Conv2d(in_channels,
601 out_channels,
602 kernel_size=3,
603 stride=1,
604 padding=1)
605
606 def forward(self, x):
607 for i, layer in enumerate(self.model):
608 if i in [1,2,3]:
609 x = layer(x, None)
610 else:
611 x = layer(x)
612
613 h = self.norm_out(x)
614 h = nonlinearity(h)
615 x = self.conv_out(h)
616 return x
617
618
619class UpsampleDecoder(nn.Module):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected