Skip to main content

BatchCollector

Struct BatchCollector 

Source
pub struct BatchCollector { /* private fields */ }
Expand description

Collects neural predicate calls for batched evaluation.

During proof search, calls are accumulated. Before neural evaluation, they are grouped by network name for efficient batched forward passes.

Implementations§

Source§

impl BatchCollector

Source

pub fn new() -> Self

Create a new empty collector.

Source

pub fn with_capacity(capacity: usize) -> Self

Create a collector with pre-allocated capacity.

Source

pub fn add(&mut self, call: NeuralCall)

Add a neural call to the collector.

Source

pub fn collect(&self) -> HashMap<String, Vec<&NeuralCall>>

Group calls by network name for batched evaluation.

Returns a map from network name to list of calls for that network.

Source

pub fn indices_for_network(&self, network: &str) -> Vec<usize>

Get all input indices for a specific network.

These indices can be used to gather inputs from the tensor source into a batched tensor for the forward pass.

Source

pub fn network_names(&self) -> Vec<String>

Get the names of all networks that have been called.

Source

pub fn call_count_for_network(&self, network: &str) -> usize

Get the number of calls for a specific network.

Source

pub fn total_input_count(&self) -> usize

Get the total number of input indices across all calls.

Source

pub fn len(&self) -> usize

Total number of calls.

Source

pub fn is_empty(&self) -> bool

Check if the collector is empty.

Source

pub fn clear(&mut self)

Clear all collected calls.

Source

pub fn iter(&self) -> impl Iterator<Item = &NeuralCall>

Iterate over all calls.

Source

pub fn take(&mut self) -> Vec<NeuralCall>

Take ownership of all calls.

Trait Implementations§

Source§

impl Default for BatchCollector

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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.

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<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

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