diff --git a/stable-diffusion.cpp b/stable-diffusion.cpp index 5d6da17..954cef7 100644 --- a/stable-diffusion.cpp +++ b/stable-diffusion.cpp @@ -2659,10 +2659,19 @@ struct DiscreteSchedule { float sigmas[TIMESTEPS]; float log_sigmas[TIMESTEPS]; - std::vector get_sigmas(int n) { + std::vector get_sigmas(uint32_t n) { std::vector result; int t_max = TIMESTEPS - 1; + + if (n == 0) { + return result; + } else if (n == 1) { + result.push_back(t_to_sigma(t_max)); + result.push_back(0); + return result; + } + float step = static_cast(t_max) / static_cast(n - 1); for (int i = 0; i < n; ++i) { float t = t_max - step * i;