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

Method forward

sat/sgm/modules/autoencoding/vqvae/movq_modules.py:292–323  ·  view source on GitHub ↗
(self, z, zq)

Source from the content-addressed store, hash-verified

290 self.conv_out = torch.nn.Conv2d(block_in, out_ch, kernel_size=3, stride=1, padding=1)
291
292 def forward(self, z, zq):
293 # assert z.shape[1:] == self.z_shape[1:]
294 self.last_z_shape = z.shape
295
296 # timestep embedding
297 temb = None
298
299 # z to block_in
300 h = self.conv_in(z)
301
302 # middle
303 h = self.mid.block_1(h, temb, zq)
304 h = self.mid.attn_1(h, zq)
305 h = self.mid.block_2(h, temb, zq)
306
307 # upsampling
308 for i_level in reversed(range(self.num_resolutions)):
309 for i_block in range(self.num_res_blocks + 1):
310 h = self.up[i_level].block[i_block](h, temb, zq)
311 if len(self.up[i_level].attn) > 0:
312 h = self.up[i_level].attn[i_block](h, zq)
313 if i_level != 0:
314 h = self.up[i_level].upsample(h)
315
316 # end
317 if self.give_pre_end:
318 return h
319
320 h = self.norm_out(h, zq)
321 h = nonlinearity(h)
322 h = self.conv_out(h)
323 return h
324
325 def forward_with_features_output(self, z, zq):
326 # assert z.shape[1:] == self.z_shape[1:]

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.70

Tested by

no test coverage detected