SNR from Continuous Log-SNR
Problem Statement
Continuous-time diffusion often works directly with lambda = log SNR. Given a log-SNR value, recover alpha_bar, SNR, and the noise standard deviation for the variance-preserving (VP) process.
Background
For the VP process, alpha_bar = sigmoid(lambda) because lambda = log(alpha_bar/(1-alpha_bar)) is exactly the logit of alpha_bar. From there:
Your Task
Implement:
def from_log_snr(lam):
Return a dict with "alpha_bar", "snr", "sigma", each rounded to 6 decimals.
Input Format
- lam (float): the log-SNR value.
Output Format
- A dict of three floats.
Sample
print(from_log_snr(0.0))
Output:
{'alpha_bar': 0.5, 'snr': 1.0, 'sigma': 0.707107}
Example
print(from_log_snr(0.0))
{'alpha_bar': 0.5, 'snr': 1.0, 'sigma': 0.707107}- Compute using the sigmoid function, which maps the log-SNR to the signal retention coefficient: .
- Determine the Signal-to-Noise Ratio (SNR) by exponentiating the log-SNR: .
- Calculate the noise standard deviation based on the variance-preserving property, where the noise variance is : .
- Round each result to 6 decimal places to match the required output format: , , and .
- The final output is
{'alpha_bar': 0.5, 'snr': 1.0, 'sigma': 0.707107}
Constraints
lamis any real number.alpha_bar = sigmoid(lam),snr = exp(lam),sigma = sqrt(1 - alpha_bar).- Round each to 6 decimals.