Trait tract_core::ops::element_wise::ElementWiseMiniOp
source · pub trait ElementWiseMiniOp: Debug + DynClone + Send + Sync + 'static + Downcast {
// Required method
fn name(&self) -> String;
// Provided methods
fn prefix(&self) -> &'static str { ... }
fn validation(&self) -> Validation { ... }
fn output_type(&self, input_type: DatumType) -> Option<DatumType> { ... }
fn eval_in_place(
&self,
t: &mut Tensor,
out_dt: Option<DatumType>
) -> TractResult<()> { ... }
fn eval_out_of_place(
&self,
t: &Tensor,
out_dt: Option<DatumType>
) -> TractResult<Tensor> { ... }
fn cost_per_element(&self, dt: DatumType) -> TVec<(Cost, usize)> { ... }
fn operating_datum_type(&self, dt: DatumType) -> DatumType { ... }
fn declutter(
&self,
model: &TypedModel,
node: &TypedNode
) -> TractResult<Option<TypedModelPatch>> { ... }
fn quantize(
&self,
dt: DatumType,
scale: f32,
zero_point: i32
) -> TractResult<Option<Box<dyn ElementWiseMiniOp>>> { ... }
fn info(&self) -> TractResult<Vec<String>> { ... }
fn same_as(&self, other: &dyn ElementWiseMiniOp) -> bool { ... }
}
Required Methods§
Provided Methods§
fn prefix(&self) -> &'static str
fn validation(&self) -> Validation
fn output_type(&self, input_type: DatumType) -> Option<DatumType>
fn eval_in_place( &self, t: &mut Tensor, out_dt: Option<DatumType> ) -> TractResult<()>
fn eval_out_of_place( &self, t: &Tensor, out_dt: Option<DatumType> ) -> TractResult<Tensor>
fn cost_per_element(&self, dt: DatumType) -> TVec<(Cost, usize)>
fn operating_datum_type(&self, dt: DatumType) -> DatumType
fn declutter( &self, model: &TypedModel, node: &TypedNode ) -> TractResult<Option<TypedModelPatch>>
fn quantize( &self, dt: DatumType, scale: f32, zero_point: i32 ) -> TractResult<Option<Box<dyn ElementWiseMiniOp>>>
fn info(&self) -> TractResult<Vec<String>>
fn same_as(&self, other: &dyn ElementWiseMiniOp) -> bool
Implementations§
source§impl dyn ElementWiseMiniOp
impl dyn ElementWiseMiniOp
sourcepub fn is<__T: ElementWiseMiniOp>(&self) -> bool
pub fn is<__T: ElementWiseMiniOp>(&self) -> bool
Returns true if the trait object wraps an object of type __T
.
sourcepub fn downcast<__T: ElementWiseMiniOp>(
self: Box<Self>
) -> Result<Box<__T>, Box<Self>>
pub fn downcast<__T: ElementWiseMiniOp>( 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.
sourcepub fn downcast_rc<__T: ElementWiseMiniOp>(
self: Rc<Self>
) -> Result<Rc<__T>, Rc<Self>>
pub fn downcast_rc<__T: ElementWiseMiniOp>( 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.
sourcepub fn downcast_ref<__T: ElementWiseMiniOp>(&self) -> Option<&__T>
pub fn downcast_ref<__T: ElementWiseMiniOp>(&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.
sourcepub fn downcast_mut<__T: ElementWiseMiniOp>(&mut self) -> Option<&mut __T>
pub fn downcast_mut<__T: ElementWiseMiniOp>(&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.