[−][src]Struct pyconnect6::pybind::PyEval
AlphaZero value, policy approximator with python callable object
it implement trait Evaluator for evaluating given boards with PyObject
Examples
let pyeval = py_policy!(); let board = [[Player::None; BOARD_SIZE]; BOARD_SIZE]; assert!(pyeval.eval(Player::Black, &vec![board]).is_some());
Methods
impl PyEval[src]
Trait Implementations
impl Evaluator for PyEval[src]
fn eval(
&self,
turn: Player,
board: &Vec<Board>
) -> Option<(Vec<f32>, Vec<[[f32; 15]; 15]>)>[src]
&self,
turn: Player,
board: &Vec<Board>
) -> Option<(Vec<f32>, Vec<[[f32; 15]; 15]>)>
Get value and prob from PyObject
Panics
- If
self.pyobjis not callable object, or method__call__is not a type of__call__(self, turn, board): (value, prob) - if return value of
self.pyobj.call()is not a tuple type object.
Errors
- if
valueis not a sequence type object consists of floats. - if
policyis not a 2D sequence type object consists of floats. - if
policyis not shaped[boards.len(), BOARD_SIZE ** 2]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom for T where
T: From<U>, [src]
T: From<U>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (
try_from)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,