MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / __init__

Method __init__

sat/sgm/modules/autoencoding/vqvae/movq_dec_3d.py:338–454  ·  view source on GitHub ↗
(
        self,
        *,
        ch,
        out_ch,
        ch_mult=(1, 2, 4, 8),
        num_res_blocks,
        attn_resolutions,
        dropout=0.0,
        resamp_with_conv=True,
        in_channels,
        resolution,
        z_channels,
        give_pre_end=False,
        zq_ch=None,
        add_conv=False,
        pad_mode="first",
        temporal_compress_times=4,
        post_quant_conv=False,
        **ignorekwargs,
    )

Source from the content-addressed store, hash-verified

336
337class NewDecoder3D(nn.Module):
338 def __init__(
339 self,
340 *,
341 ch,
342 out_ch,
343 ch_mult=(1, 2, 4, 8),
344 num_res_blocks,
345 attn_resolutions,
346 dropout=0.0,
347 resamp_with_conv=True,
348 in_channels,
349 resolution,
350 z_channels,
351 give_pre_end=False,
352 zq_ch=None,
353 add_conv=False,
354 pad_mode="first",
355 temporal_compress_times=4,
356 post_quant_conv=False,
357 **ignorekwargs,
358 ):
359 super().__init__()
360 self.ch = ch
361 self.temb_ch = 0
362 self.num_resolutions = len(ch_mult)
363 self.num_res_blocks = num_res_blocks
364 self.resolution = resolution
365 self.in_channels = in_channels
366 self.give_pre_end = give_pre_end
367
368 # log2 of temporal_compress_times
369 self.temporal_compress_level = int(np.log2(temporal_compress_times))
370
371 if zq_ch is None:
372 zq_ch = z_channels
373 if post_quant_conv:
374 self.post_quant_conv = CausalConv3d(zq_ch, z_channels, kernel_size=3, pad_mode=pad_mode)
375 else:
376 self.post_quant_conv = None
377
378 # compute in_ch_mult, block_in and curr_res at lowest res
379 in_ch_mult = (1,) + tuple(ch_mult)
380 block_in = ch * ch_mult[self.num_resolutions - 1]
381 curr_res = resolution // 2 ** (self.num_resolutions - 1)
382 self.z_shape = (1, z_channels, curr_res, curr_res)
383 print("Working with z of shape {} = {} dimensions.".format(self.z_shape, np.prod(self.z_shape)))
384
385 # z to block_in
386 # self.conv_in = torch.nn.Conv3d(z_channels,
387 # block_in,
388 # kernel_size=3,
389 # stride=1,
390 # padding=1)
391 self.conv_in = CausalConv3d(z_channels, block_in, kernel_size=3, pad_mode=pad_mode)
392
393 # middle
394 self.mid = nn.Module()
395 self.mid.block_1 = ResnetBlock3D(

Callers

nothing calls this directly

Calls 9

appendMethod · 0.80
insertMethod · 0.80
CausalConv3dClass · 0.70
ResnetBlock3DClass · 0.70
AttnBlock2DClass · 0.70
Upsample3DClass · 0.70
Normalize3DFunction · 0.70
printFunction · 0.50
__init__Method · 0.45

Tested by

no test coverage detected