(self, x)
| 818 | print("Encoder3D initialized.") |
| 819 | |
| 820 | def forward(self, x): |
| 821 | # timestep embedding |
| 822 | temb = None |
| 823 | |
| 824 | # downsampling |
| 825 | h = self.conv_in(x) |
| 826 | for i_level in range(self.num_resolutions): |
| 827 | for i_block in range(self.num_res_blocks): |
| 828 | h = self.down[i_level].block[i_block](h, temb) |
| 829 | if len(self.down[i_level].attn) > 0: |
| 830 | h = self.down[i_level].attn[i_block](h) |
| 831 | if i_level != self.num_resolutions - 1: |
| 832 | h = self.down[i_level].downsample(h) |
| 833 | |
| 834 | # middle |
| 835 | h = self.mid.block_1(h, temb) |
| 836 | h = self.mid.block_2(h, temb) |
| 837 | |
| 838 | # end |
| 839 | # h = conv_gather_from_context_parallel_region(h, dim=2, kernel_size=1) |
| 840 | h = self.norm_out(h) |
| 841 | # h = conv_scatter_to_context_parallel_region(h, dim=2, kernel_size=1) |
| 842 | |
| 843 | h = nonlinearity(h) |
| 844 | h = self.conv_out(h) |
| 845 | |
| 846 | return h |
| 847 | |
| 848 | # * ContextParallelDecoder3D has 123.37 M params |
| 849 | class ContextParallelDecoder3D(nn.Module): |
nothing calls this directly
no test coverage detected