[−][src]Trait tract_core::ops::InferenceOp
An operation with tensor type inference
Required methods
fn infer_facts(
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
Infer properties about inputs and output tensors. This method does not need to deal with the "trivial" stateless op with fully determined inputs cases.
Most of the time, it is implemented using InferenceRulesOp.
fn as_op(&self) -> &dyn Op
Reinterpret the InferenceOp as an Op.
fn as_op_mut(&mut self) -> &mut dyn Op
Reinterpret the InferenceOp as an Op, mutably.
Provided methods
fn infer(
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
Infers properties about the input and output tensors.
The inputs and outputs arguments correspond to properties about
the input and output tensors that are already known.
The default implementation will call the private infer_facts method, which is usually implemented using the InferenceRulesOp trait. It will also try to eval() the op if its a StatelessOp and if the inputs are fully determined.
Returns Err in case of an unrecoverable error during the inference, and the refined properties about the inputs and outputs otherwise.
fn observe_outlets(
&self,
_model: &InferenceModel,
_node: &InferenceNode
) -> TractResult<Vec<OutletId>>
&self,
_model: &InferenceModel,
_node: &InferenceNode
) -> TractResult<Vec<OutletId>>
Allow an op to specify a supplementary list of outlets facts that will trigger inference again.
fn nboutputs(&self) -> TractResult<usize>
fn to_typed(
&self,
_source: &InferenceModel,
_node: &InferenceNode,
_target: &mut TypedModel,
_mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>
&self,
_source: &InferenceModel,
_node: &InferenceNode,
_target: &mut TypedModel,
_mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>
Called during translation to TypedModel.
Trait Implementations
impl AsRef<dyn Op + 'static> for dyn InferenceOp[src]
impl AsMut<dyn Op + 'static> for dyn InferenceOp[src]
Implementors
impl InferenceOp for Inference[src]
fn infer_facts(
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
_observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>[src]
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
_observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
fn to_typed(
&self,
_source: &InferenceModel,
node: &InferenceNode,
target: &mut TypedModel,
mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>[src]
&self,
_source: &InferenceModel,
node: &InferenceNode,
target: &mut TypedModel,
mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>
fn nboutputs(&self) -> TractResult<usize>[src]
fn as_op(&self) -> &dyn Op[src]
fn as_op_mut(&mut self) -> &mut dyn Op[src]
impl<O: InferenceRulesOp + Op> InferenceOp for O[src]
fn infer_facts(
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>[src]
&mut self,
inputs: TVec<&InferenceFact>,
outputs: TVec<&InferenceFact>,
observed: TVec<&InferenceFact>
) -> TractResult<(TVec<InferenceFact>, TVec<InferenceFact>, TVec<InferenceFact>)>
fn nboutputs(&self) -> TractResult<usize>[src]
fn observe_outlets(
&self,
_model: &InferenceModel,
_node: &InferenceNode
) -> TractResult<Vec<OutletId>>[src]
&self,
_model: &InferenceModel,
_node: &InferenceNode
) -> TractResult<Vec<OutletId>>
fn as_op(&self) -> &dyn Op[src]
fn as_op_mut(&mut self) -> &mut dyn Op[src]
fn to_typed(
&self,
source: &InferenceModel,
node: &InferenceNode,
target: &mut TypedModel,
mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>[src]
&self,
source: &InferenceModel,
node: &InferenceNode,
target: &mut TypedModel,
mapping: &HashMap<OutletId, OutletId>
) -> TractResult<TVec<OutletId>>