mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-22 18:17:02 +08:00
Add an UCI level command "export_net".
This command writes the embedded net to the file `EvalFileDefaultName`. If there is no embedded net the command does nothing. fixes #3453 closes https://github.com/official-stockfish/Stockfish/pull/3454 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
b1c8840f10
commit
ca250e969c
@@ -47,7 +47,9 @@
|
||||
// Note that this does not work in Microsoft Visual Studio.
|
||||
#if !defined(_MSC_VER) && !defined(NNUE_EMBEDDING_OFF)
|
||||
INCBIN(EmbeddedNNUE, EvalFileDefaultName);
|
||||
constexpr bool gHasEmbeddedNet = true;
|
||||
#else
|
||||
constexpr bool gHasEmbeddedNet = false;
|
||||
const unsigned char gEmbeddedNNUEData[1] = {0x0};
|
||||
const unsigned char *const gEmbeddedNNUEEnd = &gEmbeddedNNUEData[1];
|
||||
const unsigned int gEmbeddedNNUESize = 1;
|
||||
@@ -114,6 +116,15 @@ namespace Eval {
|
||||
}
|
||||
}
|
||||
|
||||
void NNUE::export_net() {
|
||||
if constexpr (gHasEmbeddedNet) {
|
||||
ofstream stream(EvalFileDefaultName, std::ios_base::binary);
|
||||
stream.write(reinterpret_cast<const char*>(gEmbeddedNNUEData), gEmbeddedNNUESize);
|
||||
} else {
|
||||
sync_cout << "No embedded network file." << sync_endl;
|
||||
}
|
||||
}
|
||||
|
||||
/// NNUE::verify() verifies that the last net used was loaded successfully
|
||||
void NNUE::verify() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user