[][src]Trait tract_core::ops::Op

pub trait Op: Debug + Clone + Send + Sync + 'static + Downcast + StatefullOp {
    fn name(&self) -> Cow<str>;
fn as_typed(&self) -> Option<&dyn TypedOp>; fn incorporate(
        &self,
        _model: &InferenceModel,
        _node: &InferenceNode
    ) -> TractResult<Option<InferenceModelPatch>> { ... }
fn fuse(
        &self,
        _model: &TypedModel,
        _node: &TypedNode
    ) -> TractResult<Option<TypedModelPatch>> { ... }
fn nested_models(&self) -> Vec<(Cow<str>, &dyn Model)> { ... }
fn validation(&self) -> Validation { ... }
fn same_as(&self, _other: &dyn Op) -> bool { ... }
fn info(&self) -> TractResult<Vec<String>> { ... }
fn as_pulsed(&self) -> Option<&dyn PulsedOp> { ... }
fn is_canonic(&self) -> bool { ... } }

A base operation

Required methods

fn name(&self) -> Cow<str>

fn as_typed(&self) -> Option<&dyn TypedOp>

Loading content...

Provided methods

fn incorporate(
    &self,
    _model: &InferenceModel,
    _node: &InferenceNode
) -> TractResult<Option<InferenceModelPatch>>

Early pass on inference model, after analyse, but before translation to typed network. Meant to deal with some framework idiosyncrasies that manifest with temporaries nodes that can run some form of inference but require refactoring the network before it can be evaluated.

Called after succesful analyse, but before translating to typed model.

fn fuse(
    &self,
    _model: &TypedModel,
    _node: &TypedNode
) -> TractResult<Option<TypedModelPatch>>

Fuse op after codegen to deal with local optimisations.

fn nested_models(&self) -> Vec<(Cow<str>, &dyn Model)>

Nested models, with label (for audit).

fn validation(&self) -> Validation

The kind of accuracy check that should be performed on operation when testing them.

fn same_as(&self, _other: &dyn Op) -> bool

Compare two ops.

fn info(&self) -> TractResult<Vec<String>>

Short (one-line) strings giving hints on internal implementation or important configuration details to be displayed in dumps.

fn as_pulsed(&self) -> Option<&dyn PulsedOp>

fn is_canonic(&self) -> bool

Loading content...

Methods

impl dyn Op

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

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

pub fn downcast<__T: Op>(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.

pub fn downcast_rc<__T: Op>(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.

pub fn downcast_ref<__T: Op>(&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.

pub fn downcast_mut<__T: Op>(&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.

Trait Implementations

impl AsRef<dyn Op + 'static> for dyn InferenceOp[src]

impl AsRef<dyn Op + 'static> for Box<dyn InferenceOp>[src]

impl AsRef<dyn Op + 'static> for dyn TypedOp[src]

impl AsRef<dyn Op + 'static> for Box<dyn TypedOp>[src]

impl AsRef<dyn Op + 'static> for dyn PulsedOp[src]

impl AsRef<dyn Op + 'static> for Box<dyn PulsedOp>[src]

impl AsMut<dyn Op + 'static> for dyn InferenceOp[src]

impl AsMut<dyn Op + 'static> for Box<dyn InferenceOp>[src]

impl AsMut<dyn Op + 'static> for dyn TypedOp[src]

impl AsMut<dyn Op + 'static> for Box<dyn PulsedOp>[src]

impl AsMut<dyn Op + 'static> for dyn PulsedOp[src]

impl AsMut<dyn Op + 'static> for Box<dyn TypedOp>[src]

Implementors

impl Op for AddDims[src]

impl Op for Concat[src]

impl Op for ConstantLike[src]

impl Op for ConstantOfShape[src]

impl Op for Crop[src]

impl Op for EyeLike[src]

impl Op for Flatten[src]

impl Op for Gather[src]

impl Op for MultiBroadcastTo[src]

impl Op for Pad[src]

impl Op for PermuteAxes[src]

impl Op for Reshape[src]

impl Op for RmDims[src]

impl Op for Shape[src]

impl Op for Size[src]

impl Op for Split[src]

impl Op for Squeeze[src]

impl Op for StridedSlice[src]

impl Op for Tile[src]

impl Op for TypedMultiBroadcastTo[src]

impl Op for TypedReshape[src]

impl Op for InferenceBinOp[src]

impl Op for MergeOp[src]

impl Op for MergeOpUnicast[src]

impl Op for Nary[src]

impl Op for TypedBinOp[src]

impl Op for UnaryOp[src]

impl Op for Cast[src]

impl Op for AvgPool[src]

impl Op for Conv[src]

impl Op for ConvUnary[src]

impl Op for MaxPool[src]

impl Op for Downsample[src]

impl Op for Dummy[src]

impl Op for ElementWiseOp[src]

impl Op for Identity[src]

impl Op for Const[src]

impl Op for Iff[src]

impl Op for MatMul[src]

impl Op for MatMulUnary[src]

impl Op for ArgMaxMin[src]

impl Op for GlobalAvgPool[src]

impl Op for GlobalLpPool[src]

impl Op for GlobalMaxPool[src]

impl Op for LayerHardmax[src]

impl Op for LayerLogSoftmax[src]

impl Op for LayerSoftmax[src]

impl Op for Lrn[src]

impl Op for Reduce[src]

impl Op for Inference[src]

impl Op for Typed[src]

impl Op for PulsedSource[src]

impl Op for Source[src]

impl Op for TypedSource[src]

impl Op for UnimplementedOp[src]

impl Op for Delay[src]

impl<D: DimLike + ToDim> Op for Slice<D>[src]

impl<T> Op for MatMatMulPackB<T> where
    T: Copy + Datum + Add + Mul + Zero + FloatLike
[src]

impl<T: Copy + Datum + Mul + Zero> Op for Im2Col<T>[src]

Loading content...