(self, z)
| 454 | self.conv_out = CausalConv3d(block_in, out_ch, kernel_size=3, pad_mode=pad_mode) |
| 455 | |
| 456 | def forward(self, z): |
| 457 | # assert z.shape[1:] == self.z_shape[1:] |
| 458 | self.last_z_shape = z.shape |
| 459 | |
| 460 | # timestep embedding |
| 461 | temb = None |
| 462 | |
| 463 | t = z.shape[2] |
| 464 | # z to block_in |
| 465 | |
| 466 | zq = z |
| 467 | if self.post_quant_conv is not None: |
| 468 | z = self.post_quant_conv(z) |
| 469 | h = self.conv_in(z) |
| 470 | |
| 471 | # middle |
| 472 | h = self.mid.block_1(h, temb, zq) |
| 473 | # h = self.mid.attn_1(h, zq) |
| 474 | h = self.mid.block_2(h, temb, zq) |
| 475 | |
| 476 | # upsampling |
| 477 | for i_level in reversed(range(self.num_resolutions)): |
| 478 | for i_block in range(self.num_res_blocks + 1): |
| 479 | h = self.up[i_level].block[i_block](h, temb, zq) |
| 480 | if len(self.up[i_level].attn) > 0: |
| 481 | h = self.up[i_level].attn[i_block](h, zq) |
| 482 | if i_level != 0: |
| 483 | h = self.up[i_level].upsample(h) |
| 484 | |
| 485 | # end |
| 486 | if self.give_pre_end: |
| 487 | return h |
| 488 | |
| 489 | h = self.norm_out(h, zq) |
| 490 | h = nonlinearity(h) |
| 491 | h = self.conv_out(h) |
| 492 | return h |
| 493 | |
| 494 | def get_last_layer(self): |
| 495 | return self.conv_out.conv.weight |
nothing calls this directly
no test coverage detected