Struct tract_pulse::internal::TypedFact
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§
§impl TypedFact
impl TypedFact
pub fn scalar<T>() -> TypedFactwhere T: Datum,
pub fn shape<T, S>(shape: S) -> TypedFactwhere T: Datum, S: Into<ShapeFact>,
pub fn dt_scalar(datum_type: DatumType) -> TypedFact
pub fn dt_shape<S>(datum_type: DatumType, shape: S) -> TypedFactwhere S: Into<ShapeFact>,
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§
§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
§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.
§impl SpecialOps<TypedFact, Box<dyn TypedOp + 'static, Global>> for Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>
impl SpecialOps<TypedFact, Box<dyn TypedOp + 'static, Global>> for Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>
fn is_source(op: &Box<dyn TypedOp + 'static, Global>) -> bool
fn create_dummy(&self) -> Box<dyn TypedOp + 'static, Global>
fn create_source(&self, fact: TypedFact) -> Box<dyn TypedOp + 'static, Global>
fn wire_node( &mut self, name: impl Into<String>, op: impl Into<Box<dyn TypedOp + 'static, Global>>, inputs: &[OutletId] ) -> Result<SmallVec<[OutletId; 4]>, Error>
§impl Translate<TypedFact, Box<dyn TypedOp + 'static, Global>, TypedFact, Box<dyn TypedOp + 'static, Global>> for HalfTranslator
impl Translate<TypedFact, Box<dyn TypedOp + 'static, Global>, TypedFact, Box<dyn TypedOp + 'static, Global>> for HalfTranslator
fn translate_node( &self, _source: &Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, node: &Node<TypedFact, Box<dyn TypedOp + 'static, Global>>, target: &mut Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, mapping: &HashMap<OutletId, OutletId, RandomState> ) -> 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, RandomState>), Error>
§impl Translate<TypedFact, Box<dyn TypedOp + 'static, Global>, TypedFact, Box<dyn TypedOp + 'static, Global>> for SymbolValues
impl Translate<TypedFact, Box<dyn TypedOp + 'static, Global>, TypedFact, Box<dyn TypedOp + 'static, Global>> for SymbolValues
fn translate_node( &self, source: &Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, node: &Node<TypedFact, Box<dyn TypedOp + 'static, Global>>, target: &mut Graph<TypedFact, Box<dyn TypedOp + 'static, Global>>, mapping: &HashMap<OutletId, OutletId, RandomState> ) -> 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, RandomState>), Error>
impl Eq for TypedFact
impl StructuralEq for TypedFact
impl StructuralPartialEq for TypedFact
Auto Trait Implementations§
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, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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 + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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.