#pragma once #include #include "position.h" namespace rigby::policy { // Policy network trained on Lc0 visit distributions (train/policy): // 3072 threat inputs -> HIDDEN, CReLU, pairwise product (HIDDEN / 2), then one // output row per move, i8 weights quantised by 128. HIDDEN is read from the // file's size, so any trained width loads. constexpr int INPUTS = 3072; constexpr int OUTPUTS = 3920; // Loads the network built into the binary (Makefile POLICYFILE), if there is one. void init(); // Loads a network file, replacing the current one; an empty path goes back to // the built-in network (or none). False, keeping the old one, if the file does // not have the size of a network. bool load(const std::string& path); bool loaded(); int hidden(); // Raw logits of `moves` in `pos` (before any temperature). Requires loaded(). void logits(const Position& pos, const MoveList& moves, float* out); // The output row of a move, as the trainer maps it (exposed for tests). int move_index(const Position& pos, Move m); } // namespace rigby::policy