// header used in NNUE evaluation function #ifndef _EVALUATE_NNUE_H_ #define _EVALUATE_NNUE_H_ #if defined(EVAL_NNUE) #include "nnue_feature_transformer.h" #include "nnue_architecture.h" #include namespace Eval { namespace NNUE { // hash value of evaluation function structure constexpr std::uint32_t kHashValue = FeatureTransformer::GetHashValue() ^ Network::GetHashValue(); // Deleter for automating release of memory area template struct AlignedDeleter { void operator()(T* ptr) const { ptr->~T(); aligned_free(ptr); } }; template using AlignedPtr = std::unique_ptr>; // Input feature converter extern AlignedPtr feature_transformer; // Evaluation function extern AlignedPtr network; // Evaluation function file name extern const char* const kFileName; // Get a string that represents the structure of the evaluation function std::string GetArchitectureString(); // read the header bool ReadHeader(std::istream& stream, std::uint32_t* hash_value, std::string* architecture); // write the header bool WriteHeader(std::ostream& stream, std::uint32_t hash_value, const std::string& architecture); // read evaluation function parameters bool ReadParameters(std::istream& stream); // write evaluation function parameters bool WriteParameters(std::ostream& stream); } // namespace NNUE } // namespace Eval #endif // defined(EVAL_NNUE) #endif