pub struct TypedFact {
pub datum_type: DatumType,
pub shape: ShapeFact,
pub konst: Option<Arc<Tensor>>,
pub uniform: Option<Arc<Tensor>>,
pub opaque_fact: Option<Box<dyn OpaqueFact>>,
}
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
opaque_fact: Option<Box<dyn OpaqueFact>>
optional opaque fact
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_opaque_fact<O>(self, opaque_fact: O) -> TypedFact
pub fn opaque_fact(&self) -> Option<&(dyn OpaqueFact + 'static)>
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 PulsedFact> for TypedFact
impl<'a> From<&'a PulsedFact> for TypedFact
Source§fn from(fact: &'a PulsedFact) -> TypedFact
fn from(fact: &'a PulsedFact) -> TypedFact
Converts to this type from the input type.
Source§impl From<PulsedFact> for TypedFact
impl From<PulsedFact> for TypedFact
Source§fn from(fact: PulsedFact) -> TypedFact
fn from(fact: PulsedFact) -> TypedFact
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<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>
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> 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>
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