Inferer

Trait Inferer 

Source
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§

Source

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>

Execute the model on the provided pre-batched data.

Source

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>)]

Retrieve the name and shapes of the model outputs.

Source

fn begin_agent(&self, id: u64)

Source

fn end_agent(&self, id: u64)

Provided Methods§

Source

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.

Source

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>

Source§

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>

Execute the model on the provided pre-batched data.
Source§

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>)]

Retrieve the name and shapes of the model outputs.
Source§

fn begin_agent(&self, id: u64)

Source§

fn end_agent(&self, id: u64)

Source§

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.
Source§

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.
Source§

impl Inferer for Box<dyn Inferer + Send>

Source§

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>

Execute the model on the provided pre-batched data.
Source§

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>)]

Retrieve the name and shapes of the model outputs.
Source§

fn begin_agent(&self, id: u64)

Source§

fn end_agent(&self, id: u64)

Source§

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.
Source§

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.

Implementations on Foreign Types§

Source§

impl Inferer for Box<dyn Inferer + Send>

Source§

fn select_batch_size(&self, max_count: usize) -> usize

Source§

fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>

Source§

fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]

Source§

fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]

Source§

fn begin_agent(&self, id: u64)

Source§

fn end_agent(&self, id: u64)

Source§

impl Inferer for Box<dyn Inferer>

Source§

fn select_batch_size(&self, max_count: usize) -> usize

Source§

fn infer_raw(&self, batch: &mut ScratchPadView<'_>) -> Result<(), Error>

Source§

fn raw_input_shapes(&self) -> &[(String, Vec<usize>)]

Source§

fn raw_output_shapes(&self) -> &[(String, Vec<usize>)]

Source§

fn begin_agent(&self, id: u64)

Source§

fn end_agent(&self, id: u64)

Implementors§