Trait tract_libcli::model::Model

source ·
pub trait Model: Downcast + Debug + DynClone + Send + Sync {
Show 26 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) -> Cow<'_, str>; 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_for_io( &self, inputs: &[usize], outputs: &[usize] ) -> 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 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) -> Cow<'_, str>

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_for_io( &self, inputs: &[usize], outputs: &[usize] ) -> TractResult<Vec<usize>>

Eval order for the model overriding input and outputs node

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 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,

source§

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

source§

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

source§

fn node_op_name(&self, id: usize) -> Cow<'_, str>

source§

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

source§

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

source§

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

source§

fn nodes_len(&self) -> usize

source§

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

source§

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

source§

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

source§

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

source§

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

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]

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§