Janspiry / Image-Super-Resolution-via-Iterative-Refinement

Unofficial implementation of Image Super-Resolution via Iterative Refinement by Pytorch
Apache License 2.0
3.6k stars 469 forks source link

Could you explain the q_sample ? #135

Open sandeepjangir07 opened 1 year ago

sandeepjangir07 commented 1 year ago

The return of the q_sample function is defined as : return (continuous_sqrt_alpha_cumprod * x_start + (1 - continuous_sqrt_alpha_cumprod*2).sqrt() noise)

I do not understand this part . (1 - continuous_sqrt_alpha_cumprod**2).sqrt() : Why there is a need for square and the square root afterwards. I could not find anything in the main paper or the following paper that SR3 using to define their noise schedule. Some explanation would be good to understand it.

Thank you.

kada0720 commented 12 months ago

@sandeepjangir07 I have the same question

include5636 commented 10 months ago

@kada0720 @sandeepjangir07

You can find it in DDPM page 4

image

Here continuous_sqrt_alpha_cumprod is $\sqrt{\bar{\alpha}_t}$, thus continuous_sqrt_alpha_cumprod**2 equals to $\bar{\alpha}_t$

Besides, you could find similar formula in SR3 paper on the top left corner of page 3.