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

Method forward

sat/sgm/modules/autoencoding/vqvae/movq_dec_3d.py:298–331  ·  view source on GitHub ↗
(self, z, use_cp=False)

Source from the content-addressed store, hash-verified

296 self.conv_out = CausalConv3d(block_in, out_ch, kernel_size=3, pad_mode=pad_mode)
297
298 def forward(self, z, use_cp=False):
299 self.last_z_shape = z.shape
300
301 # timestep embedding
302 temb = None
303
304 t = z.shape[2]
305 # z to block_in
306
307 zq = z
308 h = self.conv_in(z)
309
310 # middle
311 h = self.mid.block_1(h, temb, zq)
312 # h = self.mid.attn_1(h, zq)
313 h = self.mid.block_2(h, temb, zq)
314
315 # upsampling
316 for i_level in reversed(range(self.num_resolutions)):
317 for i_block in range(self.num_res_blocks + 1):
318 h = self.up[i_level].block[i_block](h, temb, zq)
319 if len(self.up[i_level].attn) > 0:
320 h = self.up[i_level].attn[i_block](h, zq)
321 if i_level != 0:
322 h = self.up[i_level].upsample(h)
323
324 # end
325 if self.give_pre_end:
326 return h
327
328 h = self.norm_out(h, zq)
329 h = nonlinearity(h)
330 h = self.conv_out(h)
331 return h
332
333 def get_last_layer(self):
334 return self.conv_out.conv.weight

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.70

Tested by

no test coverage detected