[]Trait tract_onnx::prelude::Model

pub trait Model: Debug + Downcast + DynClone {
    fn model_label(&self) -> Option<&str>;
fn node_id_by_name(&self, name: &str) -> Result<usize, TractError>;
fn node_name(&self, id: usize) -> &str;
fn node_op(&self, id: usize) -> &(dyn Op + 'static);
fn node_inputs(&self, id: usize) -> &[OutletId];
fn node_output_count(&self, id: usize) -> usize;
fn nodes_len(&self) -> usize;
fn node_display(&self, id: usize) -> String;
fn node_debug(&self, id: usize) -> String;
fn eval_order(&self) -> Result<Vec<usize>, TractError>;
fn eval_order_for_io(
        &self,
        inputs: &[usize],
        outputs: &[usize]
    ) -> Result<Vec<usize>, TractError>;
fn input_outlets(&self) -> &[OutletId];
fn output_outlets(&self) -> &[OutletId];
fn outlet_typedfact(
        &self,
        outlet: OutletId
    ) -> Result<TypedFact, TractError>;
fn outlet_fact_format(&self, outlet: OutletId) -> String;
fn outlet_label(&self, id: OutletId) -> Option<&str>;
fn outlet_successors(&self, outlet: OutletId) -> &[InletId];
fn nested_models(
        &self,
        node: usize
    ) -> Vec<(Cow<str>, &(dyn Model + 'static), Vec<String>, Vec<String>)>; }

Common methods for all variants of model.

Required methods

fn model_label(&self) -> Option<&str>

Model label

fn node_id_by_name(&self, name: &str) -> Result<usize, TractError>

Lookup node id by name

fn node_name(&self, id: usize) -> &str

Node name by id

fn node_op(&self, id: usize) -> &(dyn Op + 'static)

Node op by id

fn node_inputs(&self, id: usize) -> &[OutletId]

Node inputs by id

fn node_output_count(&self, id: usize) -> usize

Number of outputs for a node, by id.

fn nodes_len(&self) -> usize

Number nodes

fn node_display(&self, id: usize) -> String

Formatted node label

fn node_debug(&self, id: usize) -> String

Formatted node label

fn eval_order(&self) -> Result<Vec<usize>, TractError>

Eval order for the model

fn eval_order_for_io(
    &self,
    inputs: &[usize],
    outputs: &[usize]
) -> Result<Vec<usize>, TractError>

Eval order for the model overriding input and outputs node

fn input_outlets(&self) -> &[OutletId]

Inputs of the model

fn output_outlets(&self) -> &[OutletId]

Outputs of the model

fn outlet_typedfact(&self, outlet: OutletId) -> Result<TypedFact, TractError>

Tensorfact for an outlet

fn outlet_fact_format(&self, outlet: OutletId) -> String

Short outlet formatter (id plus fact)

fn outlet_label(&self, id: OutletId) -> Option<&str>

Labels for an outlet

fn outlet_successors(&self, outlet: OutletId) -> &[InletId]

List consumers of an outlet

fn nested_models(
    &self,
    node: usize
) -> Vec<(Cow<str>, &(dyn Model + 'static), Vec<String>, Vec<String>)>

Nested models, with label (for audit).

Loading content...

Implementations

impl dyn Model + 'static

pub fn is<__T>(&self) -> bool where
    __T: Model

Returns true if the trait object wraps an object of type __T.

pub fn downcast<__T>(
    self: Box<dyn Model + 'static>
) -> Result<Box<__T>, Box<dyn Model + 'static>> where
    __T: Model

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn't.

pub fn downcast_rc<__T>(
    self: Rc<dyn Model + 'static>
) -> Result<Rc<__T>, Rc<dyn Model + 'static>> where
    __T: Model

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn't.

pub fn downcast_ref<__T>(&self) -> Option<&__T> where
    __T: Model

Returns a reference to the object within the trait object if it is of type __T, or None if it isn't.

pub fn downcast_mut<__T>(&mut self) -> Option<&mut __T> where
    __T: Model

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn't.

Implementors

impl<F, O> Model for ModelImpl<F, O> where
    F: Fact + Hash + Clone + 'static,
    O: Debug + Display + AsRef<dyn Op + 'static> + AsMut<dyn Op + 'static> + Clone + 'static + Hash

Loading content...