Model

Trait Model 

Source
pub trait Model:
    Downcast
    + Debug
    + DynClone
    + Send
    + Sync {
Show 27 methods // Required methods 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_const(&self, id: usize) -> bool; fn node_op_name(&self, id: usize) -> StaticName; 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) -> TractResult<Vec<usize>>; fn eval_order_opt_ram(&self) -> TractResult<Vec<usize>>; fn input_outlets(&self) -> &[OutletId]; fn set_input_names(&mut self, names: &[&str]) -> TractResult<()>; fn set_output_names(&mut self, names: &[&str]) -> TractResult<()>; 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]; fn auto_outputs(&mut self) -> TractResult<()>; fn properties(&self) -> &HashMap<String, Arc<Tensor>>; fn symbols(&self) -> &SymbolScope; fn get_or_intern_symbol(&self, name: &str) -> Symbol; fn rename_node(&mut self, id: usize, name: &str) -> TractResult<()>; // Provided methods fn nested_models(&self, id: usize) -> Vec<(String, &dyn Model)> { ... } fn nested_models_iters( &self, id: usize, input: &[&TypedFact], ) -> Option<TDim> { ... }
}
Expand description

Common methods for all variants of model.

Required Methods§

Source

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

Lookup node id by name

Source

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

Node name by id

Source

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

Node op by id

Source

fn node_const(&self, id: usize) -> bool

Node is const

Source

fn node_op_name(&self, id: usize) -> StaticName

Node op by id

Source

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

Node inputs by id

Source

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

Number of outputs for a node, by id.

Source

fn nodes_len(&self) -> usize

Number nodes

Source

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

Formatted node label

Source

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

Formatted node label

Source

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

Eval order for the model

Source

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

Eval order for the model

Source

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

Inputs of the model

Source

fn set_input_names(&mut self, names: &[&str]) -> TractResult<()>

Source

fn set_output_names(&mut self, names: &[&str]) -> TractResult<()>

Source

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

Outputs of the model

Source

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

Tensorfact for an outlet

Source

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

Short outlet formatter (id plus fact)

Source

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

Labels for an outlet

Source

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

List consumers of an outlet

Source

fn auto_outputs(&mut self) -> TractResult<()>

Source

fn properties(&self) -> &HashMap<String, Arc<Tensor>>

Source

fn symbols(&self) -> &SymbolScope

Source

fn get_or_intern_symbol(&self, name: &str) -> Symbol

Source

fn rename_node(&mut self, id: usize, name: &str) -> TractResult<()>

Provided Methods§

Source

fn nested_models(&self, id: usize) -> Vec<(String, &dyn Model)>

Subnets of a node

Source

fn nested_models_iters(&self, id: usize, input: &[&TypedFact]) -> Option<TDim>

Subnets of a node

Implementations§

Source§

impl dyn Model

Source

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

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

Source

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

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.

Source

pub fn downcast_rc<__T: Model>(self: Rc<Self>) -> Result<Rc<__T>, Rc<Self>>

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.

Source

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

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

Source

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

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

Implementations on Foreign Types§

Source§

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

Implementors§