openai/glow

About the cross split and channel-continuously split

Opened this issue · 0 comments

hi,

glow/model.py

Lines 576 to 584 in eaff217

@add_arg_scope
def split2d_prior(z):
n_z2 = int(z.get_shape()[3])
n_z1 = n_z2
h = Z.conv2d_zeros("conv", z, 2 * n_z1)
mean = h[:, :, :, 0::2]
logs = h[:, :, :, 1::2]
return Z.gaussian_diag(mean, logs)

Why use cross h to get mean and logs? Is there any difference to get mean and logs from its contiguous splits of h?
I guess maybe you want to "cross split" the featuremap to get the z1, z2 in the previous lines:

glow/model.py

Lines 545 to 555 in eaff217

@add_arg_scope
def split2d(name, z, objective=0.):
with tf.variable_scope(name):
n_z = Z.int_shape(z)[3]
z1 = z[:, :, :, :n_z // 2]
z2 = z[:, :, :, n_z // 2:]
pz = split2d_prior(z1)
objective += pz.logp(z2)
z1 = Z.squeeze2d(z1)
eps = pz.get_eps(z2)
return z1, objective, eps

As feature feed to split2d are concated from two parts of formerly revnet2d layer, the first half and second half of which are not that equal, doing a "cross split" to get z1, z2 may be a better choice.