pub struct TypedFact {
pub datum_type: DatumType,
pub shape: ShapeFact,
pub konst: Option<Arc<Tensor>>,
pub uniform: Option<Arc<Tensor>>,
}
Expand description
Fully determined tensor information for TypedModel.
Fields§
§datum_type: DatumType
tensor element type
shape: ShapeFact
tensor shape
konst: Option<Arc<Tensor>>
optional constant value
uniform: Option<Arc<Tensor>>
optional uniform value
Implementations§
source§impl TypedFact
impl TypedFact
pub fn scalar<T>() -> TypedFactwhere
T: Datum,
pub fn shape<T, S>(shape: S) -> TypedFact
pub fn shape_and_dt_of(t: &Tensor) -> TypedFact
pub fn dt_scalar(datum_type: DatumType) -> TypedFact
pub fn dt_shape<S>(datum_type: DatumType, shape: S) -> TypedFact
pub fn rank(&self) -> usize
pub fn format_dt_shape(&self) -> String
pub fn consistent(&self) -> Result<(), Error>
pub fn without_value(&self) -> TypedFact
Trait Implementations§
source§impl Fact for TypedFact
impl Fact for TypedFact
fn to_typed_fact(&self) -> Result<Cow<'_, TypedFact>, Error>
fn matches( &self, t: &Tensor, symbols: Option<&SymbolValues> ) -> Result<bool, Error>
fn same_as(&self, other: &(dyn Fact + 'static)) -> bool
source§fn compatible_with(&self, other: &(dyn Fact + 'static)) -> bool
fn compatible_with(&self, other: &(dyn Fact + 'static)) -> bool
Ensure that self is same type as another fact or a subtype
fn datum_type(&self) -> Option<DatumType>
source§impl<'a> From<&'a TypedFact> for InferenceFact
impl<'a> From<&'a TypedFact> for InferenceFact
source§fn from(t: &'a TypedFact) -> InferenceFact
fn from(t: &'a TypedFact) -> InferenceFact
Converts to this type from the input type.
source§impl From<TypedFact> for InferenceFact
impl From<TypedFact> for InferenceFact
source§fn from(t: TypedFact) -> InferenceFact
fn from(t: TypedFact) -> InferenceFact
Converts to this type from the input type.
source§impl PartialEq for TypedFact
impl PartialEq for TypedFact
source§impl SpecialOps<TypedFact, Box<dyn TypedOp>> for Graph<TypedFact, Box<dyn TypedOp>>
impl SpecialOps<TypedFact, Box<dyn TypedOp>> for Graph<TypedFact, Box<dyn TypedOp>>
fn is_source(op: &Box<dyn TypedOp>) -> bool
fn create_dummy(&self) -> Box<dyn TypedOp>
fn create_source(&self, fact: TypedFact) -> Box<dyn TypedOp>
fn wire_node( &mut self, name: impl Into<String>, op: impl Into<Box<dyn TypedOp>>, inputs: &[OutletId] ) -> Result<SmallVec<[OutletId; 4]>, Error>
fn add_const( &mut self, name: impl Into<String>, v: impl IntoArcTensor ) -> Result<OutletId, Error>
source§impl<T1, T2> Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for FloatPrecisionTranslator<T1, T2>
impl<T1, T2> Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for FloatPrecisionTranslator<T1, T2>
fn translate_node( &self, _source: &Graph<TypedFact, Box<dyn TypedOp>>, node: &Node<TypedFact, Box<dyn TypedOp>>, target: &mut Graph<TypedFact, Box<dyn TypedOp>>, mapping: &HashMap<OutletId, OutletId> ) -> Result<SmallVec<[OutletId; 4]>, Error>
fn translate_model( &self, source: &Graph<TI1, O1> ) -> Result<Graph<TI2, O2>, Error>
fn translate_model_with_mappings( &self, source: &Graph<TI1, O1> ) -> Result<(Graph<TI2, O2>, HashMap<OutletId, OutletId>), Error>
source§impl Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for SymbolValues
impl Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for SymbolValues
fn translate_node( &self, source: &Graph<TypedFact, Box<dyn TypedOp>>, node: &Node<TypedFact, Box<dyn TypedOp>>, target: &mut Graph<TypedFact, Box<dyn TypedOp>>, mapping: &HashMap<OutletId, OutletId> ) -> Result<SmallVec<[OutletId; 4]>, Error>
fn translate_model( &self, source: &Graph<TI1, O1> ) -> Result<Graph<TI2, O2>, Error>
fn translate_model_with_mappings( &self, source: &Graph<TI1, O1> ) -> Result<(Graph<TI2, O2>, HashMap<OutletId, OutletId>), Error>
source§impl<'a> TryFrom<&'a InferenceFact> for TypedFact
impl<'a> TryFrom<&'a InferenceFact> for TypedFact
source§fn try_from(fact: &InferenceFact) -> TractResult<TypedFact>
fn try_from(fact: &InferenceFact) -> TractResult<TypedFact>
Performs the conversion.
impl Eq for TypedFact
impl StructuralPartialEq for TypedFact
Auto Trait Implementations§
impl Freeze for TypedFact
impl RefUnwindSafe for TypedFact
impl Send for TypedFact
impl Sync for TypedFact
impl Unpin for TypedFact
impl UnwindSafe for TypedFact
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more