[]Trait tract_tensorflow::prelude::TypedOp

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

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
{ ... } }

Required methods

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

Reinterpret the TypedOp as an Op.

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

Reinterpret the TypedOp as an Op, mutably.

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

Deduce output facts from input facts.

Loading content...

Provided methods

pub fn invariants(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>,
    node: &Node<TypedFact, Box<dyn TypedOp + 'static, Global>>
) -> Result<Invariants, Error>

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

Fuse op after codegen to deal with local optimisations.

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

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

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

Computes a cost hint of the operation.

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

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

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

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

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

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

Returns None if the op can not be translated.

pub fn concretize_dims(
    &self,
    source: &Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>,
    node: &Node<TypedFact, Box<dyn TypedOp + 'static, Global>>,
    target: &mut Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>,
    mapping: &HashMap<OutletId, OutletId, RandomState>,
    values: &SymbolValues
) -> Result<SmallVec<[OutletId; 4]>, Error>

Transform the op into by providing a value to one or more symbols.

pub fn codegen(
    &self,
    model: &Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>,
    node: &Node<TypedFact, Box<dyn TypedOp + 'static, Global>>
) -> Result<Option<ModelPatch<TypedFact, Box<dyn TypedOp + 'static, Global>>>, Error>

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.

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

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>

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 ConstantLike[src]

impl TypedOp for EyeLike[src]

impl TypedOp for FiniteReshape

impl TypedOp for MatMul

impl TypedOp for MergeOpUnicast

impl TypedOp for ConvUnary

impl TypedOp for Im2Col

impl TypedOp for Gather

impl TypedOp for MaxPool

impl TypedOp for SumPool

impl TypedOp for MultiBroadcastTo

impl TypedOp for Iff

impl TypedOp for Downsample

impl TypedOp for AxisOp

impl TypedOp for TypedSource

impl TypedOp for Pad

impl TypedOp for TypedConcat

impl TypedOp for DequantizeLinearF32

impl TypedOp for Scan

impl TypedOp for Tile

impl TypedOp for OneHot

impl TypedOp for MatMulUnary

impl TypedOp for UnaryOp

impl TypedOp for Identity

impl TypedOp for TypedBinOp

impl TypedOp for Const

impl TypedOp for Dummy

impl TypedOp for Slice

impl TypedOp for LirMatMulUnary

impl TypedOp for ElementWiseOp

impl TypedOp for Reduce

impl TypedOp for ConstantOfShape

impl TypedOp for MatMatMulPack

impl TypedOp for LirScan

impl TypedOp for Delay

impl TypedOp for PulsePad

Loading content...

Implementors

impl TypedOp for Merge[src]

impl TypedOp for BatchToSpaceUnary[src]

impl TypedOp for SpaceToBatchUnary[src]

impl TypedOp for Noop[src]

impl TypedOp for Assign[src]

impl TypedOp for VariableV2[src]

Loading content...