MCPcopy Create free account
hub / github.com/dek924/PerX2CT / __init__

Method __init__

x2ct_nerf/modules/diffusionmodules/model.py:1278–1309  ·  view source on GitHub ↗
(self, in_channels, out_channels, ch, num_res_blocks, resolution,
                 ch_mult=(2, 2), dropout=0.0)

Source from the content-addressed store, hash-verified

1276
1277class UpsampleDecoder(nn.Module):
1278 def __init__(self, in_channels, out_channels, ch, num_res_blocks, resolution,
1279 ch_mult=(2, 2), dropout=0.0):
1280 super().__init__()
1281 # upsampling
1282 self.temb_ch = 0
1283 self.num_resolutions = len(ch_mult)
1284 self.num_res_blocks = num_res_blocks
1285 block_in = in_channels
1286 curr_res = resolution // 2 ** (self.num_resolutions - 1)
1287 self.res_blocks = nn.ModuleList()
1288 self.upsample_blocks = nn.ModuleList()
1289 for i_level in range(self.num_resolutions):
1290 res_block = []
1291 block_out = ch * ch_mult[i_level]
1292 for i_block in range(self.num_res_blocks + 1):
1293 res_block.append(ResnetBlock(in_channels=block_in,
1294 out_channels=block_out,
1295 temb_channels=self.temb_ch,
1296 dropout=dropout))
1297 block_in = block_out
1298 self.res_blocks.append(nn.ModuleList(res_block))
1299 if i_level != self.num_resolutions - 1:
1300 self.upsample_blocks.append(Upsample(block_in, True))
1301 curr_res = curr_res * 2
1302
1303 # end
1304 self.norm_out = Normalize(block_in)
1305 self.conv_out = torch.nn.Conv2d(block_in,
1306 out_channels,
1307 kernel_size=3,
1308 stride=1,
1309 padding=1)
1310
1311 def forward(self, x):
1312 # upsampling

Callers

nothing calls this directly

Calls 4

ResnetBlockClass · 0.70
UpsampleClass · 0.70
NormalizeFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected