FauziAkram
2023-12-30 15:22:17 +03:00
committed by Disservin
parent 4f99dfcae2
commit 833a2e2bc0
11 changed files with 37 additions and 37 deletions
+7 -7
View File
@@ -34,11 +34,11 @@ class Position;
namespace Stockfish::Eval::NNUE::Features {
// Feature HalfKAv2_hm: Combination of the position of own king
// and the position of pieces. Position mirrored such that king always on e..h files.
// Feature HalfKAv2_hm: Combination of the position of own king and the
// position of pieces. Position mirrored such that king is always on e..h files.
class HalfKAv2_hm {
// unique number for each piece type on each square
// Unique number for each piece type on each square
enum {
PS_NONE = 0,
PS_W_PAWN = 0,
@@ -56,8 +56,8 @@ class HalfKAv2_hm {
};
static constexpr IndexType PieceSquareIndex[COLOR_NB][PIECE_NB] = {
// convention: W - us, B - them
// viewed from other side, W and B are reversed
// Convention: W - us, B - them
// Viewed from other side, W and B are reversed
{PS_NONE, PS_W_PAWN, PS_W_KNIGHT, PS_W_BISHOP, PS_W_ROOK, PS_W_QUEEN, PS_KING, PS_NONE,
PS_NONE, PS_B_PAWN, PS_B_KNIGHT, PS_B_BISHOP, PS_B_ROOK, PS_B_QUEEN, PS_KING, PS_NONE},
{PS_NONE, PS_B_PAWN, PS_B_KNIGHT, PS_B_BISHOP, PS_B_ROOK, PS_B_QUEEN, PS_KING, PS_NONE,
@@ -140,8 +140,8 @@ class HalfKAv2_hm {
static int update_cost(const StateInfo* st);
static int refresh_cost(const Position& pos);
// Returns whether the change stored in this StateInfo means that
// a full accumulator refresh is required.
// Returns whether the change stored in this StateInfo means
// that a full accumulator refresh is required.
static bool requires_refresh(const StateInfo* st, Color perspective);
};
@@ -235,7 +235,7 @@ class AffineTransformSparseInput {
const auto input32 = reinterpret_cast<const std::int32_t*>(input);
// Find indices of nonzero 32bit blocks
// Find indices of nonzero 32-bit blocks
find_nnz<NumChunks>(input32, nnz, count);
const outvec_t* biasvec = reinterpret_cast<const outvec_t*>(biases);
+1 -1
View File
@@ -91,7 +91,7 @@ class SqrClippedReLU {
for (IndexType i = Start; i < InputDimensions; ++i)
{
output[i] = static_cast<OutputType>(
// Really should be /127 but we need to make it fast so we right shift
// Really should be /127 but we need to make it fast so we right-shift
// by an extra 7 bits instead. Needs to be accounted for in the trainer.
std::min(127ll, ((long long) (input[i]) * input[i]) >> (2 * WeightScaleBits + 7)));
}
+8 -8
View File
@@ -112,7 +112,7 @@ inline IntType read_little_endian(std::istream& stream) {
// Utility to write an integer (signed or unsigned, any size)
// to a stream in little-endian order. We swap the byte order before the write if
// necessary to always write in little endian order, independently of the byte
// necessary to always write in little-endian order, independently of the byte
// ordering of the compiling machine.
template<typename IntType>
inline void write_little_endian(std::ostream& stream, IntType value) {
@@ -141,8 +141,8 @@ inline void write_little_endian(std::ostream& stream, IntType value) {
}
// Read integers in bulk from a little indian stream.
// This reads N integers from stream s and put them in array out.
// Read integers in bulk from a little-endian stream.
// This reads N integers from stream s and puts them in array out.
template<typename IntType>
inline void read_little_endian(std::istream& stream, IntType* out, std::size_t count) {
if (IsLittleEndian)
@@ -153,7 +153,7 @@ inline void read_little_endian(std::istream& stream, IntType* out, std::size_t c
}
// Write integers in bulk to a little indian stream.
// Write integers in bulk to a little-endian stream.
// This takes N integers from array values and writes them on stream s.
template<typename IntType>
inline void write_little_endian(std::ostream& stream, const IntType* values, std::size_t count) {
@@ -165,8 +165,8 @@ inline void write_little_endian(std::ostream& stream, const IntType* values, std
}
// Read N signed integers from the stream s, putting them in
// the array out. The stream is assumed to be compressed using the signed LEB128 format.
// Read N signed integers from the stream s, putting them in the array out.
// The stream is assumed to be compressed using the signed LEB128 format.
// See https://en.wikipedia.org/wiki/LEB128 for a description of the compression scheme.
template<typename IntType>
inline void read_leb_128(std::istream& stream, IntType* out, std::size_t count) {
@@ -216,8 +216,8 @@ inline void read_leb_128(std::istream& stream, IntType* out, std::size_t count)
// Write signed integers to a stream with LEB128 compression.
// This takes N integers from array values, compress them with the LEB128 algorithm and
// writes the result on the stream s.
// This takes N integers from array values, compresses them with
// the LEB128 algorithm and writes the result on the stream s.
// See https://en.wikipedia.org/wiki/LEB128 for a description of the compression scheme.
template<typename IntType>
inline void write_leb_128(std::ostream& stream, const IntType* values, std::size_t count) {
+3 -3
View File
@@ -366,14 +366,14 @@ class FeatureTransformer {
// The size must be enough to contain the largest possible update.
// That might depend on the feature set and generally relies on the
// feature set's update cost calculation to be correct and never
// allow updates with more added/removed features than MaxActiveDimensions.
// feature set's update cost calculation to be correct and never allow
// updates with more added/removed features than MaxActiveDimensions.
FeatureSet::IndexList removed[N - 1], added[N - 1];
{
int i =
N
- 2; // last potential state to update. Skip last element because it must be nullptr.
- 2; // Last potential state to update. Skip last element because it must be nullptr.
while (states_to_update[i] == nullptr)
--i;