iaf-vae icon indicating copy to clipboard operation
iaf-vae copied to clipboard

Is PixelCNN masking reversed in original implementation?

Open DaehanKim opened this issue 9 months ago • 0 comments

Thanks for sharing this, Lucas!

I saw the implementation of masked convolution in the original openai repo

def get_conv_ar_mask(h, w, n_in, n_out, zerodiagonal=False):
    l = (h - 1) / 2
    m = (w - 1) / 2
    mask = np.ones([h, w, n_in, n_out], dtype=np.float32)
    mask[:l, :, :, :] = 0
    mask[l, :m, :, :] = 0
    mask[l, m, :, :] = get_linear_ar_mask(n_in, n_out, zerodiagonal)
    return mask

which was a reversed mask, considering that conv filters run from left to right and from top to bottom. Their theano implementation was the same. Correct one would be something like:

mask[l+1:, :, :, :] = 0
mask[l, m:, :, :] = 0

But I saw your implementation is same as what I expected. so how did you figure this out? or did you have any opinion on this?

Thanks!

DaehanKim avatar May 25 '24 14:05 DaehanKim