Skip to main content

CompiledProgram

Struct CompiledProgram 

Source
pub struct CompiledProgram { /* private fields */ }

Implementations§

Source§

impl CompiledProgram

Source

pub fn evaluate( &self, _py: Python<'_>, return_grads: bool, samples: Option<usize>, seed: Option<u64>, confidence: f64, max_nonmonotone_iterations: usize, sampling_method: Option<String>, memory_mb: Option<u64>, allow_cpu_oracle: bool, ) -> PyResult<EvalResult>

Source

pub fn evaluate_device( &self, py: Python<'_>, samples: Option<usize>, seed: Option<u64>, confidence: f64, max_nonmonotone_iterations: usize, sampling_method: Option<String>, memory_mb: Option<u64>, ) -> PyResult<McDeviceEvalResult>

Evaluate Monte Carlo programs and return device-only result counts via DLPack.

This is the primary GPU-native API surface for MC inference. It never performs device->host reads for result data (only returns device buffers).

Source

pub fn zero_grad(&self, py: Python<'_>) -> PyResult<()>

Zero gradients for all registered networks.

This should be called at the start of each training iteration to clear accumulated gradients from previous iterations.

Source

pub fn optimizer_step(&self, py: Python<'_>) -> PyResult<()>

Perform optimizer step for all registered networks.

This applies the accumulated gradients to update network parameters. Should be called after forward_backward().

Source

pub fn clip_grad_norms(&self, py: Python<'_>, max_norm: f64) -> PyResult<()>

Clip gradient norms for all registered networks.

Uses torch.nn.utils.clip_grad_norm_.

Source

pub fn evaluate_loss(&self, queries: Vec<String>) -> PyResult<f64>

Evaluate mean NLL loss over queries without updating parameters.

Useful for validation/test set evaluation.

§Arguments
  • queries - List of query strings to evaluate
§Returns

Mean NLL loss over all queries

Source

pub fn memory_stats(&self, py: Python<'_>) -> PyResult<PyObject>

Return memory diagnostics including allocated_bytes and memory_limit_bytes.

Source

pub fn rule_provenance(&self, py: Python<'_>) -> PyResult<PyObject>

Source

pub fn proof_traces(&self, py: Python<'_>) -> PyResult<PyObject>

Source

pub fn host_transfer_stats(&self, py: Python<'_>) -> PyResult<PyObject>

Source

pub fn reset_host_transfer_stats(&self)

Source

pub fn neural_hot_loop_diagnostics(&self, py: Python<'_>) -> PyResult<PyObject>

Source

pub fn cuda_graph_stats(&self, py: Python<'_>) -> PyResult<PyObject>

Trait Implementations§

Source§

impl IntoPy<Py<PyAny>> for CompiledProgram

Source§

fn into_py(self, py: Python<'_>) -> PyObject

👎Deprecated since 0.23.0:

IntoPy is going to be replaced by IntoPyObject. See the migration guide (https://pyo3.rs/v0.23.0/migration) for more information.

Performs the conversion.
Source§

impl<'py> IntoPyObject<'py> for CompiledProgram

Source§

type Target = CompiledProgram

The Python output type
Source§

type Output = Bound<'py, <CompiledProgram as IntoPyObject<'py>>::Target>

The smart pointer type to use. Read more
Source§

type Error = PyErr

The type returned in the event of a conversion error.
Source§

fn into_pyobject( self, py: Python<'py>, ) -> Result<<Self as IntoPyObject<'_>>::Output, <Self as IntoPyObject<'_>>::Error>

Performs the conversion.
Source§

impl PyClass for CompiledProgram

Source§

type Frozen = False

Whether the pyclass is frozen. Read more
Source§

impl PyClassImpl for CompiledProgram

Source§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
Source§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
Source§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
Source§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
Source§

type BaseType = PyAny

Base class
Source§

type ThreadChecker = SendablePyClass<CompiledProgram>

This handles following two situations: Read more
Source§

type Inventory = Pyo3MethodsInventoryForCompiledProgram

Source§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild

Immutable or mutable
Source§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
Source§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
Source§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
Source§

fn items_iter() -> PyClassItemsIter

Source§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
Source§

fn lazy_type_object() -> &'static LazyTypeObject<Self>

§

fn dict_offset() -> Option<isize>

§

fn weaklist_offset() -> Option<isize>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a CompiledProgram

Source§

type Holder = Option<PyRef<'py, CompiledProgram>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl<'a, 'py> PyFunctionArgument<'a, 'py, false> for &'a mut CompiledProgram

Source§

type Holder = Option<PyRefMut<'py, CompiledProgram>>

Source§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

Source§

impl PyTypeInfo for CompiledProgram

Source§

const NAME: &'static str = "CompiledProgram"

Class name.
Source§

const MODULE: Option<&'static str> = ::core::option::Option::None

Module name, if any.
Source§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

👎Deprecated since 0.23.0:

renamed to PyTypeInfo::type_object

Deprecated name for [PyTypeInfo::type_object].
§

fn is_type_of(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0:

renamed to PyTypeInfo::is_type_of

Deprecated name for [PyTypeInfo::is_type_of].
§

fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

👎Deprecated since 0.23.0:

renamed to PyTypeInfo::is_exact_type_of

Deprecated name for [PyTypeInfo::is_exact_type_of].
Source§

impl DerefToPyAny for CompiledProgram

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<'py, T> IntoPyObjectExt<'py> for T
where T: IntoPyObject<'py>,

§

fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>

Converts self into an owned Python object, dropping type information.
§

fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>

Converts self into an owned Python object, dropping type information and unbinding it from the 'py lifetime.
§

fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>

Converts self into a Python object. Read more
§

impl<T> PyErrArguments for T
where T: for<'py> IntoPyObject<'py> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,