pub trait Inferer {
// Required methods
fn select_batch_size(&self, max_count: usize) -> usize;
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>;
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)];
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)];
fn begin_agent(&self, id: u64);
fn end_agent(&self, id: u64);
// Provided methods
fn input_shapes(&self) -> &[(String, Vec<usize>)] { ... }
fn output_shapes(&self) -> &[(String, Vec<usize>)] { ... }
}Expand description
The main workhorse shared by all components in Cervo.
Required Methods§
Sourcefn select_batch_size(&self, max_count: usize) -> usize
fn select_batch_size(&self, max_count: usize) -> usize
Query the inferer for how many elements it can deal with in a single batch.
Sourcefn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
Execute the model on the provided pre-batched data.
Sourcefn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs.
Sourcefn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs.
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Provided Methods§
Sourcefn input_shapes(&self) -> &[(String, Vec<usize>)]
fn input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs. This API only contains the external API, so code-based transforms outside the model are hidden.
Sourcefn output_shapes(&self) -> &[(String, Vec<usize>)]
fn output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs. This API only contains the external API, so code-based transforms outside the model are hidden.
Trait Implementations§
Source§impl Inferer for Box<dyn Inferer>
impl Inferer for Box<dyn Inferer>
Source§fn select_batch_size(&self, max_count: usize) -> usize
fn select_batch_size(&self, max_count: usize) -> usize
Query the inferer for how many elements it can deal with in a single batch.
Source§fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
Execute the model on the provided pre-batched data.
Source§fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs.
Source§fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs.
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Source§impl Inferer for Box<dyn Inferer + Send>
impl Inferer for Box<dyn Inferer + Send>
Source§fn select_batch_size(&self, max_count: usize) -> usize
fn select_batch_size(&self, max_count: usize) -> usize
Query the inferer for how many elements it can deal with in a single batch.
Source§fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
Execute the model on the provided pre-batched data.
Source§fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model inputs.
Source§fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
Retrieve the name and shapes of the model outputs.
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Implementations on Foreign Types§
Source§impl Inferer for Box<dyn Inferer + Send>
impl Inferer for Box<dyn Inferer + Send>
fn select_batch_size(&self, max_count: usize) -> usize
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Source§impl Inferer for Box<dyn Inferer>
impl Inferer for Box<dyn Inferer>
fn select_batch_size(&self, max_count: usize) -> usize
fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>
fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]
fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]
fn begin_agent(&self, id: u64)
fn end_agent(&self, id: u64)
Implementors§
impl Inferer for BasicInferer
impl Inferer for DynamicInferer
impl Inferer for FixedBatchInferer
impl Inferer for MemoizingDynamicInferer
impl<T> Inferer for RecurrentTracker<T>where
T: Inferer,
impl<T, NG> Inferer for EpsilonInjector<T, NG>where
T: Inferer,
NG: NoiseGenerator,
impl<WrapStack: InfererWrapper, Inf: Inferer> Inferer for StatefulInferer<WrapStack, Inf>
See Inferer for documentation.