[]Trait tract_onnx::prelude::TypedOp

pub trait TypedOp: 'static + StatefullOp + Op + Send + Sync + Debug + Downcast + DynHash + DynClone {
    fn as_op(&self) -> &(dyn Op + 'static);
fn as_op_mut(&mut self) -> &mut (dyn Op + 'static);
fn output_facts(
        &self,
        inputs: &[&TypedFact]
    ) -> Result<SmallVec<[TypedFact; 4]>, TractError>; fn invariants(
        &self,
        model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
    ) -> Result<Invariants, TractError> { ... }
fn fuse(
        &self,
        _model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        _node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
    ) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError> { ... }
fn declutter(
        &self,
        model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
    ) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError> { ... }
fn cost(
        &self,
        _inputs: &[&TypedFact]
    ) -> Result<SmallVec<[(Cost, TDim); 4]>, TractError> { ... }
fn suggested_axis_changes(
        &self
    ) -> Result<SmallVec<[(InOut, AxisOp); 4]>, TractError> { ... }
fn change_axes(
        &self,
        model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
        io: InOut,
        change: &AxisOp
    ) -> Result<Option<AxisChangeConsequence>, TractError> { ... }
fn slice_output(
        &self,
        model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
        patch: &mut ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>,
        output_slot: usize,
        axis: usize,
        start: usize,
        end: usize
    ) -> Result<Option<OutletId>, TractError> { ... }
fn quantize(
        &self,
        model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
        dt: DatumType,
        scale: f32,
        zero_point: i32
    ) -> Result<Option<Box<dyn TypedOp + 'static>>, TractError> { ... }
fn pulsify(
        &self,
        _source: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
        _target: &mut Graph<PulsedFact, Box<dyn PulsedOp + 'static>>,
        _mapping: &HashMap<OutletId, OutletId, RandomState>,
        _pulse: usize
    ) -> Result<SmallVec<[OutletId; 4]>, TractError> { ... }
fn concretize_stream_dim(
        &self,
        _source: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
        target: &mut Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        mapping: &HashMap<OutletId, OutletId, RandomState>,
        _stream_dim: usize
    ) -> Result<SmallVec<[OutletId; 4]>, TractError> { ... }
fn codegen(
        &self,
        _model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
        _node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
    ) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError> { ... }
fn nested_model_multipliers(
        &self,
        inputs: &[&TypedFact]
    ) -> Vec<(Cow<'_, str>, f64)> { ... } }

Required methods

fn as_op(&self) -> &(dyn Op + 'static)

Reinterpret the TypedOp as an Op.

fn as_op_mut(&mut self) -> &mut (dyn Op + 'static)

Reinterpret the TypedOp as an Op, mutably.

fn output_facts(
    &self,
    inputs: &[&TypedFact]
) -> Result<SmallVec<[TypedFact; 4]>, TractError>

Deduce output facts from input facts.

Loading content...

Provided methods

fn invariants(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
) -> Result<Invariants, TractError>

fn fuse(
    &self,
    _model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    _node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError>

Fuse op after codegen to deal with local optimisations.

fn declutter(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError>

Declutter the op to the tract_core operator set as much as possible.

fn cost(
    &self,
    _inputs: &[&TypedFact]
) -> Result<SmallVec<[(Cost, TDim); 4]>, TractError>

Computes a cost hint of the operation.

Each pair is a type of operation and a number per call on eval.

fn suggested_axis_changes(
    &self
) -> Result<SmallVec<[(InOut, AxisOp); 4]>, TractError>

fn change_axes(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
    io: InOut,
    change: &AxisOp
) -> Result<Option<AxisChangeConsequence>, TractError>

fn slice_output(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
    patch: &mut ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>,
    output_slot: usize,
    axis: usize,
    start: usize,
    end: usize
) -> Result<Option<OutletId>, TractError>

fn quantize(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
    dt: DatumType,
    scale: f32,
    zero_point: i32
) -> Result<Option<Box<dyn TypedOp + 'static>>, TractError>

Transforms the op in an equivalent one, operating on dt (i8 or u8).

Returns None if the op can not be translated.

fn pulsify(
    &self,
    _source: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
    _target: &mut Graph<PulsedFact, Box<dyn PulsedOp + 'static>>,
    _mapping: &HashMap<OutletId, OutletId, RandomState>,
    _pulse: usize
) -> Result<SmallVec<[OutletId; 4]>, TractError>

Translate an op from a typed network to a pulsing equivalent form, if possible.

fn concretize_stream_dim(
    &self,
    _source: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>,
    target: &mut Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    mapping: &HashMap<OutletId, OutletId, RandomState>,
    _stream_dim: usize
) -> Result<SmallVec<[OutletId; 4]>, TractError>

Transform the op into by making the S dimension concrete.

fn codegen(
    &self,
    _model: &Graph<TypedFact, Box<dyn TypedOp + 'static>>,
    _node: &BaseNode<TypedFact, Box<dyn TypedOp + 'static>>
) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static>>>, TractError>

Translate the op into the most efficient form possible for execution.

This transformation is supposed to be final, no more pass are expected to be run on the codegen networks.

fn nested_model_multipliers(
    &self,
    inputs: &[&TypedFact]
) -> Vec<(Cow<'_, str>, f64)>

Nested model multipliers, with label (for profiling).

Loading content...

Trait Implementations

impl AsMut<dyn Op + 'static> for dyn TypedOp + 'static

impl AsRef<dyn Op + 'static> for dyn TypedOp + 'static

Implementations on Foreign Types

impl TypedOp for EyeLike[src]

impl TypedOp for LayerHardmax[src]

impl TypedOp for ConstantLike[src]

impl TypedOp for SumPool

impl TypedOp for MatMul

impl TypedOp for Gather

impl TypedOp for TypedConcat

impl TypedOp for TypedBinOp

impl TypedOp for Downsample

impl TypedOp for PulsePad

impl TypedOp for Dummy

impl TypedOp for TypedSource

impl TypedOp for MergeOpUnicast

impl TypedOp for UnaryOp

impl TypedOp for Pad

impl TypedOp for ConvUnary

impl TypedOp for Scan

impl<D> TypedOp for Slice<D> where
    D: DimLike + ToDim + Hash

impl TypedOp for Const

impl TypedOp for AxisOp

impl TypedOp for ElementWiseOp

impl TypedOp for DequantizeLinearF32

impl TypedOp for MaxPool

impl TypedOp for Identity

impl<T> TypedOp for Im2Col<T> where
    T: Datum + Copy + Zero

impl<T> TypedOp for MatMatMulPackB<T> where
    T: Copy + Datum + Zero

impl TypedOp for Reduce

impl TypedOp for LirScan

impl TypedOp for MatMulUnary

impl TypedOp for Delay

impl TypedOp for Iff

impl TypedOp for Tile

impl TypedOp for MultiBroadcastTo

impl TypedOp for FiniteReshape

Loading content...

Implementors

Loading content...