Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not understand plus_in = inv_stdv * (centered_x + 1./255.) in discretized_mix_logistic_loss #33

Open
blues-lin opened this issue Mar 26, 2018 · 4 comments

Comments

@blues-lin
Copy link

blues-lin commented Mar 26, 2018

In file nn.py:
Could anybody help me out explain why here is + 1./255. not 0.5 as paper equation (2) ?

60.    centered_x = x - means
61.    inv_stdv = tf.exp(-log_scales)
62.    plus_in = inv_stdv * (centered_x + 1./255.)
63.    cdf_plus = tf.nn.sigmoid(plus_in)
64.    min_in = inv_stdv * (centered_x - 1./255.)
65.    cdf_min = tf.nn.sigmoid(min_in)
@powder21
Copy link

input to pixelCNN is scaled from uint8 [0,255] to float in range [-1,1]
so the original value divide by 255/2, and 0.5 should be 0.5/(255/2) = 1/255

@blues-lin
Copy link
Author

blues-lin commented Apr 3, 2018

Here I'm still confused, for the model, inputs are values between [-1, 1]. And function sample_from_discretized_mix_logistic output in [-1, 1] which means model output value is in the same range as inputs. Why should model need knowledge about original data scale (unscaled data)?

@sharvil
Copy link

sharvil commented Nov 15, 2018

I agree with @blues-lin; the expression should be +/-0.5 / 255. Shifting and changing the scale of the input doesn't change the number of discretized buckets. The probability of x should be computed with a bucket width of 1 centered around x, i.e. x +/-0.5 / (buckets-1).

@powder21
Copy link

I agree with @blues-lin; the expression should be +/-0.5 / 255. Shifting and changing the scale of the input doesn't change the number of discretized buckets. The probability of x should be computed with a bucket width of 1 centered around x, i.e. x +/-0.5 / (buckets-1).

width of +/-0.5 / 255 is 1/255, and there will be 2/(1/256)=512 buckets, which is 256 in paper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants