[][src]Trait tract_core::model::Model

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

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) -> TractResult<usize>

Lookup node id by name

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

Node name by id

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

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_format(&self, id: usize) -> String

Formatted node label

fn eval_order(&self) -> TractResult<Vec<usize>>

Eval order for the model

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

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) -> TractResult<TypedFact>

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

Loading content...

Methods

impl dyn Model[src]

pub fn is<__T: Model>(&self) -> bool[src]

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

pub fn downcast<__T: Model>(self: Box<Self>) -> Result<Box<__T>, Box<Self>>[src]

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: Model>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>[src]

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: Model>(&self) -> Option<&__T>[src]

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: Model>(&mut self) -> Option<&mut __T>[src]

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 + Clone + 'static,
    O: Debug + Display + AsRef<dyn Op> + AsMut<dyn Op> + Clone + 'static, 
[src]

Loading content...