LeelaChessZero / lc0

The rewritten engine, originally for tensorflow. Now all other backends have been ported here.
GNU General Public License v3.0
2.37k stars 523 forks source link

Fix unsigned int conversion from cpp to Python. #1952

Closed revalo closed 6 months ago

revalo commented 6 months ago

The custom pybind implementation for the Python binding has a bug when returning the masks for the input planes.

Py_BuildValue() takes a format string for converting C++ values to Python integers. Lowercase k is used for unsigned long, and uppercase K is used for unsigned long long. For uint64_t, we want to use the latter.

Previously, the bits were being stripped to 32 bits.

borg323 commented 6 months ago

Was this found on windows?

revalo commented 6 months ago

Was this found on windows?

Yes, is there a reason for the suspicion?

borg323 commented 6 months ago

is there a reason for the suspicion?

If it wasn't observed on windows it would require deeper investigation, since the code works on linux and the size of long is a known difference between them.