### Down block This combines `ResidualBlock` and `AttentionBlock`. These are used in the first half of U-Net at each resolution.
| 117 | |
| 118 | |
| 119 | class DownBlock(nn.Module): |
| 120 | """ |
| 121 | ### Down block |
| 122 | This combines `ResidualBlock` and `AttentionBlock`. These are used in the first half of U-Net at each resolution. |
| 123 | """ |
| 124 | |
| 125 | def __init__(self, in_channels: int, out_channels: int, time_channels: int, is_noise: bool = True): |
| 126 | super().__init__() |
| 127 | self.res = ResidualBlock(in_channels, out_channels, time_channels, is_noise=is_noise) |
| 128 | |
| 129 | def forward(self, x: torch.Tensor, t: torch.Tensor): |
| 130 | x = self.res(x, t) |
| 131 | return x |
| 132 | |
| 133 | |
| 134 | class UpBlock(nn.Module): |