| 544 | throw std::runtime_error("ACE-Step diffusion expected a nonnegative value for Python-style rounding"); |
| 545 | } |
| 546 | const double x = static_cast<double>(value); |
| 547 | const double floor_value = std::floor(x); |
| 548 | const double fraction = x - floor_value; |
| 549 | int64_t rounded = static_cast<int64_t>(floor_value); |
| 550 | if (fraction > 0.5) { |
| 551 | ++rounded; |
| 552 | } else if (fraction == 0.5 && (rounded % 2) != 0) { |
| 553 | ++rounded; |
| 554 | } |
| 555 | return rounded; |
| 556 | } |
| 557 | |
| 558 | std::vector<float> apply_cfg_guidance( |
| 559 | const std::vector<float> & pred_cond, |
| 560 | const std::vector<float> & pred_uncond, |
| 561 | float guidance_scale) { |
| 562 | return engine::sampling::cfg_guidance(pred_cond, pred_uncond, guidance_scale); |
| 563 | } |
| 564 | |
| 565 | std::vector<float> apply_apg_guidance( |
| 566 | const std::vector<float> & pred_cond, |