Struct tract_tensorflow::prelude::InferenceFact[][src]

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

impl InferenceFact[src]

pub fn new() -> InferenceFact[src]

Constructs the most general tensor fact possible.

pub fn any() -> InferenceFact[src]

pub fn dt(dt: DatumType) -> InferenceFact[src]

pub fn dt_shape<S>(dt: DatumType, shape: S) -> InferenceFact where
    S: Into<ShapeFactoid>, 
[src]

pub fn shape<S>(shape: S) -> InferenceFact where
    S: Into<ShapeFactoid>, 
[src]

pub fn with_datum_type(self, dt: DatumType) -> InferenceFact[src]

pub fn with_shape<S>(self, shape: S) -> InferenceFact where
    S: Into<ShapeFactoid>, 
[src]

pub fn format_dt_shape(&self) -> String[src]

pub fn dt_shape_from_tensor(t: &Tensor) -> InferenceFact[src]

pub fn without_value(self) -> InferenceFact[src]

Trait Implementations

impl Clone for InferenceFact[src]

pub fn clone(&self) -> InferenceFact[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for InferenceFact[src]

pub fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Default for InferenceFact[src]

pub fn default() -> InferenceFact[src]

Returns the “default value” for a type. Read more

impl Fact for InferenceFact[src]

pub fn to_typed_fact(&self) -> Result<TypedFact, Error>[src]

pub fn matches(&self, t: &Tensor) -> Result<bool, Error>[src]

pub fn same_as(&self, other: &(dyn Fact + 'static)) -> bool[src]

pub fn compatible_with(&self, other: &(dyn Fact + 'static)) -> bool[src]

impl Factoid for InferenceFact[src]

pub fn concretize(&self) -> Option<<InferenceFact as Factoid>::Concrete>[src]

Tries to transform the fact into a concrete value.

pub fn unify(&self, other: &InferenceFact) -> Result<InferenceFact, Error>[src]

Tries to unify the fact with another fact of the same type.

type Concrete = Arc<Tensor>

fn is_concrete(&self) -> bool[src]

Returns whether the value is fully determined.

fn unify_with(&mut self, other: &Self) -> Result<bool, Error>[src]

Tries to unify the fact with another fact of the same type and update self. Read more

fn unify_with_mut(&mut self, other: &mut Self) -> Result<bool, Error>[src]

Tries to unify the fact with another fact of the same type and update both of them. Read more

fn unify_all(facts: &mut [&mut Self]) -> Result<bool, Error>[src]

Tries to unify all facts in the list. Read more

impl<'a> From<&'a Arc<Tensor>> for InferenceFact[src]

pub fn from(t: &'a Arc<Tensor>) -> InferenceFact[src]

Performs the conversion.

impl<'a> From<&'a InferenceFact> for InferenceFact[src]

pub fn from(t: &'a InferenceFact) -> InferenceFact[src]

Performs the conversion.

impl<'a> From<&'a Tensor> for InferenceFact[src]

pub fn from(t: &'a Tensor) -> InferenceFact[src]

Performs the conversion.

impl<'a> From<&'a TypedFact> for InferenceFact[src]

pub fn from(t: &'a TypedFact) -> InferenceFact[src]

Performs the conversion.

impl From<Arc<Tensor>> for InferenceFact[src]

pub fn from(t: Arc<Tensor>) -> InferenceFact[src]

Performs the conversion.

impl From<Tensor> for InferenceFact[src]

pub fn from(t: Tensor) -> InferenceFact[src]

Performs the conversion.

impl Hash for InferenceFact[src]

pub fn hash<__H>(&self, state: &mut __H) where
    __H: Hasher
[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl PartialEq<InferenceFact> for InferenceFact[src]

pub fn eq(&self, other: &InferenceFact) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &InferenceFact) -> bool[src]

This method tests for !=.

impl SpecialOps<InferenceFact, Box<dyn InferenceOp + 'static, Global>> for Graph<InferenceFact, Box<dyn InferenceOp + 'static, Global>>[src]

pub fn is_source(op: &Box<dyn InferenceOp + 'static, Global>) -> bool[src]

pub fn create_dummy(&self) -> Box<dyn InferenceOp + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?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;
[src]

pub fn create_source(
    &self,
    _fact: InferenceFact
) -> Box<dyn InferenceOp + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?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;
[src]

pub fn wire_node(
    &mut self,
    name: impl Into<String>,
    op: impl Into<Box<dyn InferenceOp + 'static, Global>>,
    inputs: &[OutletId]
) -> Result<SmallVec<[OutletId; 4]>, Error>
[src]

impl<'a> TryFrom<&'a InferenceFact> for TypedFact[src]

type Error = Error

The type returned in the event of a conversion error.

pub fn try_from(fact: &InferenceFact) -> Result<TypedFact, Error>[src]

Performs the conversion.

impl StructuralPartialEq for InferenceFact[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> Downcast for T where
    T: Any

pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Notable traits for Box<R, Global>

impl<R> Read for Box<R, Global> where
    R: Read + ?Sized
impl<W> Write for Box<W, Global> where
    W: Write + ?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

pub 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

pub 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

pub 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

impl<T> DowncastSync for T where
    T: Any + Send + Sync

pub fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + 'static + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

impl<T> DynClone for T where
    T: Clone
[src]

pub fn __clone_box(&self, Private) -> *mut ()[src]

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.