lczerolens.backends#

Utils from the lczero executable and bindings.

Notes

The lczero bindings are not installed by default. You can install them by running pip install lczerolens[backends].

Functions#

generic_command(args[, verbose])

Run a generic command.

describenet(path[, verbose])

Describe the net at the given path.

convert_to_onnx(in_path, out_path[, verbose])

Convert the net at the given path.

convert_to_leela(in_path, out_path[, verbose])

Convert the net at the given path.

board_from_backend(lczero_backend, lczero_game[, planes])

Create a board from the lczero backend.

prediction_from_backend(lczero_backend, lczero_game[, ...])

Predicts the move.

moves_with_castling_swap(lczero_game, board)

Get the moves with castling swap.

Module Contents#

lczerolens.backends.generic_command(args, verbose=False)[source]#

Run a generic command.

lczerolens.backends.describenet(path, verbose=False)[source]#

Describe the net at the given path.

lczerolens.backends.convert_to_onnx(in_path, out_path, verbose=False)[source]#

Convert the net at the given path.

lczerolens.backends.convert_to_leela(in_path, out_path, verbose=False)[source]#

Convert the net at the given path.

lczerolens.backends.board_from_backend(lczero_backend, lczero_game, planes=112)[source]#

Create a board from the lczero backend.

Parameters:
  • lczero_backend (lczero.backends.Backend)

  • lczero_game (lczero.backends.GameState)

  • planes (int)

lczerolens.backends.prediction_from_backend(lczero_backend, lczero_game, softmax=False, only_legal=False, illegal_value=0)[source]#

Predicts the move.

Parameters:
  • lczero_backend (lczero.backends.Backend)

  • lczero_game (lczero.backends.GameState)

  • softmax (bool)

  • only_legal (bool)

  • illegal_value (float)

lczerolens.backends.moves_with_castling_swap(lczero_game, board)[source]#

Get the moves with castling swap.

Parameters: