MCPcopy Create free account
hub / github.com/NVlabs/CTG / __init__

Method __init__

tbsim/models/diffuser_helpers.py:358–379  ·  view source on GitHub ↗
(self, input_shape, output_channel, encoder_channels, bilinear=True, batchnorm=True)

Source from the content-addressed store, hash-verified

356 """
357
358 def __init__(self, input_shape, output_channel, encoder_channels, bilinear=True, batchnorm=True):
359 super(MapGridDecoder, self).__init__()
360 input_channel = input_shape[0]
361 input_hw = np.array(input_shape[1:])
362 self.conv1 = nn.Sequential(
363 nn.Conv2d(input_channel, 512, kernel_size=3,
364 stride=1, padding=1, bias=False),
365 nn.ReLU(True)
366 )
367
368 self.up1 = Up(512 + encoder_channels[-1], 256, bilinear)
369 input_hw = input_hw * 2
370
371 self.up2 = Up(256 + encoder_channels[-2], 128, bilinear)
372 input_hw = input_hw * 2
373
374 self.up3 = Up(128 + encoder_channels[-3], 64, bilinear)
375 input_hw = input_hw * 2
376
377 self.conv2 = ConvBlock(64, [64, 64, 64], kernel_size=3, stride=1, batchnorm=batchnorm)
378 self.conv3 = nn.Conv2d(64, output_channel, kernel_size=1)
379 self.out_norm = nn.LayerNorm((output_channel, int(input_hw[0]), int(input_hw[1])))
380
381 def forward(self, feat_to_decode: torch.Tensor, encoder_feats: List[torch.Tensor]):
382 assert len(encoder_feats) >= 3

Callers

nothing calls this directly

Calls 3

UpClass · 0.90
ConvBlockClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected