#include "diffusion.hpp" #include #include #include #include #include #include #include namespace { std::vector read_f32(const std::string &path) { std::ifstream in(path, std::ios::binary | std::ios::ate); if (!in || in.tellg() < 0 || static_cast(in.tellg()) % sizeof(float)) throw std::runtime_error("invalid fixture: " + path); std::vector values(static_cast(in.tellg())/sizeof(float)); in.seekg(0); in.read(reinterpret_cast(values.data()), static_cast(values.size()*sizeof(float))); if (!in) throw std::runtime_error("short fixture: " + path); return values; } } int main(int argc, char **argv) try { if (argc != 2) { std::fprintf(stderr, "usage: kimodo-fixture-sampler-parity FIXTURE_DIR\n"); return 2; } const std::string dir = std::string(argv[1]) + "/"; const auto root=read_f32(dir+"root_output.f32"), body=read_f32(dir+"body_output.f32"), expected=read_f32(dir+"sampling_output_0.f32"); if (root.size() % 15 || body.size() % (3*268)) throw std::runtime_error("unexpected CFG fixture dimensions"); const size_t frames=root.size()/(3*5); std::vector predicted(expected.size()); if (expected.size() != frames*273 || body.size()/(3*268) != frames) throw std::runtime_error("unexpected fixture dimensions"); for(size_t b=0;b<1;++b) for(size_t t=0;t