[][src]Struct tfmicro::MicroInterpreter

pub struct MicroInterpreter<'a> { /* fields omitted */ }

An interpreter for TensorFlow models

Implementations

impl<'a> MicroInterpreter<'a>[src]

pub fn new<'m: 'a, 't: 'a, TArena, OpResolver>(
    model: &'m Model,
    resolver: OpResolver,
    tensor_arena: TArena
) -> Result<Self, Error> where
    OpResolver: OpResolverRepr,
    TArena: Into<ManagedSlice<'t, u8>>, 
[src]

Create a new micro_interpreter from a Model, a MicroOpResolver and a tensor arena (scratchpad).

Errors

Returns Error::InterpreterInitError if there is an error creating the interpreter.

Returns Error::AllocateTensors if there is error in the call to AllocateTensors.

pub fn input_info(&self, n: usize) -> TensorInfo[src]

Returns a TensorInfo that describes the nth input tensor.

Panics

Panics if the underlying tensor cannot be represented by a TensorInfo.

pub fn input<T: ElemTypeOf + Clone>(
    &mut self,
    n: usize,
    data: &[T]
) -> Result<(), Error>
[src]

Clones data into the nth input tensor.

Errors

Returns Error::InputDataLenMismatch if the length of slice data does not match the flat length of the nth input tensor.

Returns an Error if the underlying tensor cannot be represented by a TensorInfo.

Panics

Panics if the attempt to get a pointer from TensorFlow returns a nullptr. This can occour if the tensor index n is invalid.

pub fn invoke(&mut self) -> Result<(), Status>[src]

Runs the Tensorflow operation to transform input tensors to output tensors

Errors

Returns a TensorFlow Status if an error occours in TensorFlow.

pub fn output(&self, n: usize) -> &'a Tensor[src]

Returns an immutable reference to the nth output tensor

Panics

Panics if the attempt to get a pointer from TensorFlow returns a nullptr. This can occour if the tensor index n is invalid.

pub fn arena_used_bytes(&self) -> usize[src]

Returns the actual number of bytes required for the arena

Auto Trait Implementations

impl<'a> RefUnwindSafe for MicroInterpreter<'a>

impl<'a> Send for MicroInterpreter<'a>

impl<'a> Sync for MicroInterpreter<'a>

impl<'a> Unpin for MicroInterpreter<'a>

impl<'a> UnwindSafe for MicroInterpreter<'a>

Blanket Implementations

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

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

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

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

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

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.

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.