Skip to main content

TfLiteTensor

Struct TfLiteTensor 

Source
#[repr(C)]
pub struct TfLiteTensor {
Show 15 fields pub type_: TfLiteType, pub data: TfLitePtrUnion, pub dims: *mut TfLiteIntArray, pub params: TfLiteQuantizationParams, pub allocation_type: TfLiteAllocationType, pub bytes: usize, pub allocation: *const c_void, pub name: *const c_char, pub delegate: *mut TfLiteDelegate, pub buffer_handle: TfLiteBufferHandle, pub data_is_stale: bool, pub is_variable: bool, pub quantization: TfLiteQuantization, pub sparsity: *mut TfLiteSparsity, pub dims_signature: *const TfLiteIntArray,
}

Fields§

§type_: TfLiteType

The data type specification for data stored in data. This affects what member of data union should be used.

§data: TfLitePtrUnion

A union of data pointers. The appropriate type should be used for a typed tensor based on type.

§dims: *mut TfLiteIntArray

A pointer to a structure representing the dimensionality interpretation that the buffer should have. NOTE: the product of elements of dims and the element datatype size should be equal to bytes below.

§params: TfLiteQuantizationParams

Quantization information.

§allocation_type: TfLiteAllocationType

How memory is mapped kTfLiteMmapRo: Memory mapped read only. i.e. weights kTfLiteArenaRw: Arena allocated read write memory (i.e. temporaries, outputs).

§bytes: usize

The number of bytes required to store the data of this Tensor. I.e. (bytes of each element) * dims[0] * … * dims[n-1]. For example, if type is kTfLiteFloat32 and dims = {3, 2} then bytes = sizeof(float) * 3 * 2 = 4 * 3 * 2 = 24.

§allocation: *const c_void

An opaque pointer to a tflite::MMapAllocation

§name: *const c_char

Null-terminated name of this tensor.

§delegate: *mut TfLiteDelegate

The delegate which knows how to handle buffer_handle.

WARNING: This is an experimental interface that is subject to change.

§buffer_handle: TfLiteBufferHandle

An integer buffer handle that can be handled by delegate. The value is valid only when delegate is not null.

WARNING: This is an experimental interface that is subject to change.

§data_is_stale: bool

If the delegate uses its own buffer (e.g. GPU memory), the delegate is responsible to set data_is_stale to true. delegate->CopyFromBufferHandle can be called to copy the data from delegate buffer.

WARNING: This is an experimental interface that is subject to change.

§is_variable: bool

True if the tensor is a variable.

§quantization: TfLiteQuantization

Quantization information. Replaces params field above.

§sparsity: *mut TfLiteSparsity

Parameters used to encode a sparse tensor. This is optional. The field is NULL if a tensor is dense.

WARNING: This is an experimental interface that is subject to change.

§dims_signature: *const TfLiteIntArray

Optional. Encodes shapes with unknown dimensions with -1. This field is only populated when unknown dimensions exist in a read-write tensor (i.e. an input or output tensor). (e.g. dims contains [1, 1, 1, 3] and dims_signature contains [1, -1, -1, 3]). If no unknown dimensions exist then dims_signature is either null, or set to an empty array. Note that this field only exists when TF_LITE_STATIC_MEMORY is not defined.

Trait Implementations§

Source§

impl Clone for TfLiteTensor

Source§

fn clone(&self) -> TfLiteTensor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TfLiteTensor

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.