[−][src]Struct tfmicro::MicroInterpreter
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]
model: &'m Model,
resolver: OpResolver,
tensor_arena: TArena
) -> Result<Self, Error> where
OpResolver: OpResolverRepr,
TArena: Into<ManagedSlice<'t, u8>>,
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 n
th 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]
&mut self,
n: usize,
data: &[T]
) -> Result<(), Error>
Clones data into the n
th input tensor.
Errors
Returns Error::InputDataLenMismatch
if the length of slice data
does not match the flat length of the n
th 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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,