MCPcopy Create free account
hub / github.com/Royalvice/DocDiff / UpBlock

Class UpBlock

model/DocDiff.py:134–148  ·  view source on GitHub ↗

### Up block This combines `ResidualBlock` and `AttentionBlock`. These are used in the second half of U-Net at each resolution.

Source from the content-addressed store, hash-verified

132
133
134class UpBlock(nn.Module):
135 """
136 ### Up block
137 This combines `ResidualBlock` and `AttentionBlock`. These are used in the second half of U-Net at each resolution.
138 """
139
140 def __init__(self, in_channels: int, out_channels: int, time_channels: int, is_noise: bool = True):
141 super().__init__()
142 # The input has `in_channels + out_channels` because we concatenate the output of the same resolution
143 # from the first half of the U-Net
144 self.res = ResidualBlock(in_channels + out_channels, out_channels, time_channels, is_noise=is_noise)
145
146 def forward(self, x: torch.Tensor, t: torch.Tensor):
147 x = self.res(x, t)
148 return x
149
150
151class MiddleBlock(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected