Struct tract_tensorflow::prelude::InferenceFact
source · [−]pub struct InferenceFact {
pub datum_type: GenericFactoid<DatumType>,
pub shape: ShapeFactoid,
pub value: GenericFactoid<Arc<Tensor>>,
}Expand description
Partial information about a tensor.
The task of the analyser is to tag every edge in the graph with information about the tensors that flow through it - specifically their datum_type, their shape and possibly their value. During the analysis, however, we might only know some of that information (say, for instance, that an edge only carries tensors of rank 4, but without knowing their precise dimension).
This is where tensor facts come in: they hold partial information about the datum_type, shape and value of tensors that might flow through an edge of the graph. The analyser will first tag each edge with a fact, starting with the most general one and specializing it at each iteration. Eventually, it will reach a fixed point that - hopefully - holds enough information.
Fields
datum_type: GenericFactoid<DatumType>shape: ShapeFactoidvalue: GenericFactoid<Arc<Tensor>>Implementations
sourceimpl InferenceFact
impl InferenceFact
sourcepub fn new() -> InferenceFact
pub fn new() -> InferenceFact
Constructs the most general tensor fact possible.
pub fn any() -> InferenceFact
pub fn dt(dt: DatumType) -> InferenceFact
pub fn dt_shape<S>(dt: DatumType, shape: S) -> InferenceFact where
S: Into<ShapeFactoid>,
pub fn shape<S>(shape: S) -> InferenceFact where
S: Into<ShapeFactoid>,
pub fn with_datum_type(self, dt: DatumType) -> InferenceFact
pub fn with_shape<S>(self, shape: S) -> InferenceFact where
S: Into<ShapeFactoid>,
pub fn format_dt_shape(&self) -> String
pub fn dt_shape_from_tensor(t: &Tensor) -> InferenceFact
pub fn without_value(self) -> InferenceFact
Trait Implementations
sourceimpl Clone for InferenceFact
impl Clone for InferenceFact
sourcefn clone(&self) -> InferenceFact
fn clone(&self) -> InferenceFact
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for InferenceFact
impl Debug for InferenceFact
sourceimpl Default for InferenceFact
impl Default for InferenceFact
sourcefn default() -> InferenceFact
fn default() -> InferenceFact
Returns the “default value” for a type. Read more
sourceimpl Fact for InferenceFact
impl Fact for InferenceFact
sourceimpl Factoid for InferenceFact
impl Factoid for InferenceFact
sourcefn concretize(&self) -> Option<<InferenceFact as Factoid>::Concrete>
fn concretize(&self) -> Option<<InferenceFact as Factoid>::Concrete>
Tries to transform the fact into a concrete value.
sourcefn unify(&self, other: &InferenceFact) -> Result<InferenceFact, Error>
fn unify(&self, other: &InferenceFact) -> Result<InferenceFact, Error>
Tries to unify the fact with another fact of the same type.
type Concrete = Arc<Tensor>
sourcefn is_concrete(&self) -> bool
fn is_concrete(&self) -> bool
Returns whether the value is fully determined.
sourcefn unify_with(&mut self, other: &Self) -> Result<bool, Error>
fn unify_with(&mut self, other: &Self) -> Result<bool, Error>
Tries to unify the fact with another fact of the same type and update self. Read more
sourceimpl<'a> From<&'a Arc<Tensor>> for InferenceFact
impl<'a> From<&'a Arc<Tensor>> for InferenceFact
sourcefn from(t: &'a Arc<Tensor>) -> InferenceFact
fn from(t: &'a Arc<Tensor>) -> InferenceFact
Converts to this type from the input type.
sourceimpl<'a> From<&'a InferenceFact> for InferenceFact
impl<'a> From<&'a InferenceFact> for InferenceFact
sourcefn from(t: &'a InferenceFact) -> InferenceFact
fn from(t: &'a InferenceFact) -> InferenceFact
Converts to this type from the input type.
sourceimpl<'a> From<&'a Tensor> for InferenceFact
impl<'a> From<&'a Tensor> for InferenceFact
sourcefn from(t: &'a Tensor) -> InferenceFact
fn from(t: &'a Tensor) -> InferenceFact
Converts to this type from the input type.
sourceimpl<'a> From<&'a TypedFact> for InferenceFact
impl<'a> From<&'a TypedFact> for InferenceFact
sourcefn from(t: &'a TypedFact) -> InferenceFact
fn from(t: &'a TypedFact) -> InferenceFact
Converts to this type from the input type.
sourceimpl From<Arc<Tensor>> for InferenceFact
impl From<Arc<Tensor>> for InferenceFact
sourcefn from(t: Arc<Tensor>) -> InferenceFact
fn from(t: Arc<Tensor>) -> InferenceFact
Converts to this type from the input type.
sourceimpl From<Tensor> for InferenceFact
impl From<Tensor> for InferenceFact
sourcefn from(t: Tensor) -> InferenceFact
fn from(t: Tensor) -> InferenceFact
Converts to this type from the input type.
sourceimpl From<TypedFact> for InferenceFact
impl From<TypedFact> for InferenceFact
sourcefn from(t: TypedFact) -> InferenceFact
fn from(t: TypedFact) -> InferenceFact
Converts to this type from the input type.
sourceimpl Hash for InferenceFact
impl Hash for InferenceFact
sourceimpl PartialEq<InferenceFact> for InferenceFact
impl PartialEq<InferenceFact> for InferenceFact
sourcefn eq(&self, other: &InferenceFact) -> bool
fn eq(&self, other: &InferenceFact) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &InferenceFact) -> bool
fn ne(&self, other: &InferenceFact) -> bool
This method tests for !=.
sourceimpl SpecialOps<InferenceFact, Box<dyn InferenceOp + 'static, Global>> for Graph<InferenceFact, Box<dyn InferenceOp + 'static, Global>>
impl SpecialOps<InferenceFact, Box<dyn InferenceOp + 'static, Global>> for Graph<InferenceFact, Box<dyn InferenceOp + 'static, Global>>
fn is_source(op: &Box<dyn InferenceOp + 'static, Global>) -> bool
fn create_dummy(&self) -> Box<dyn InferenceOp + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn create_source(
&self,
_fact: InferenceFact
) -> Box<dyn InferenceOp + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn wire_node(
&mut self,
name: impl Into<String>,
op: impl Into<Box<dyn InferenceOp + 'static, Global>>,
inputs: &[OutletId]
) -> Result<SmallVec<[OutletId; 4]>, Error>
sourceimpl<'a> TryFrom<&'a InferenceFact> for TypedFact
impl<'a> TryFrom<&'a InferenceFact> for TypedFact
impl StructuralPartialEq for InferenceFact
Auto Trait Implementations
impl RefUnwindSafe for InferenceFact
impl Send for InferenceFact
impl Sync for InferenceFact
impl Unpin for InferenceFact
impl UnwindSafe for InferenceFact
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;
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. Read more
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. Read more
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. Read more
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. Read more