pub struct TypedFact {
pub datum_type: DatumType,
pub shape: ShapeFact,
pub konst: Option<Arc<Tensor>>,
pub uniform: Option<Arc<Tensor>>,
pub exotic_fact: Option<Box<dyn ExoticFact>>,
pub uniform_tdim: Option<TDim>,
pub region_of_interest: Option<TDim>,
}Expand description
Fully determined tensor information for TypedModel.
Fields§
§datum_type: DatumTypetensor element type
shape: ShapeFacttensor shape
konst: Option<Arc<Tensor>>optional constant value
uniform: Option<Arc<Tensor>>optional uniform value
exotic_fact: Option<Box<dyn ExoticFact>>optional exotic fact
uniform_tdim: Option<TDim>Symbolic per-element value as a TDim expression, possibly involving
coordinate symbols 🎯0,🎯1,… and/or model symbols.
None means “unknown / not tracked”.
region_of_interest: Option<TDim>Boolean TDim expression in coordinate symbols defining which positions
in the tensor are relevant to downstream consumers.
None means “all positions matter” (no demand annotation).
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 mem_size(&self) -> TDim
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
pub fn with_exotic_fact<O>(self, exotic_fact: O) -> TypedFact
pub fn exotic_fact(&self) -> Option<&(dyn ExoticFact + 'static)>
pub fn is_exotic(&self) -> bool
pub fn is_plain(&self) -> bool
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>
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 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 Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for FloatPrecisionTranslator
impl Translate<TypedFact, Box<dyn TypedOp>, TypedFact, Box<dyn TypedOp>> for FloatPrecisionTranslator
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 TryFrom<&InferenceFact> for TypedFact
impl TryFrom<&InferenceFact> for TypedFact
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 UnsafeUnpin 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
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