MCPcopy Index your code
hub / github.com/LTH14/mar / forward

Method forward

models/vae.py:365–396  ·  view source on GitHub ↗
(self, z)

Source from the content-addressed store, hash-verified

363 )
364
365 def forward(self, z):
366 # assert z.shape[1:] == self.z_shape[1:]
367 self.last_z_shape = z.shape
368
369 # timestep embedding
370 temb = None
371
372 # z to block_in
373 h = self.conv_in(z)
374
375 # middle
376 h = self.mid.block_1(h, temb)
377 h = self.mid.attn_1(h)
378 h = self.mid.block_2(h, temb)
379
380 # upsampling
381 for i_level in reversed(range(self.num_resolutions)):
382 for i_block in range(self.num_res_blocks + 1):
383 h = self.up[i_level].block[i_block](h, temb)
384 if len(self.up[i_level].attn) > 0:
385 h = self.up[i_level].attn[i_block](h)
386 if i_level != 0:
387 h = self.up[i_level].upsample(h)
388
389 # end
390 if self.give_pre_end:
391 return h
392
393 h = self.norm_out(h)
394 h = nonlinearity(h)
395 h = self.conv_out(h)
396 return h
397
398
399class DiagonalGaussianDistribution(object):

Callers

nothing calls this directly

Calls 1

nonlinearityFunction · 0.85

Tested by

no test coverage detected