Struct tract_tensorflow::tfpb::tensorflow::TensorProto[][src]

pub struct TensorProto {
Show fields pub dtype: i32, pub tensor_shape: Option<TensorShapeProto>, pub version_number: i32, pub tensor_content: Vec<u8>, pub half_val: Vec<i32>, pub float_val: Vec<f32>, pub double_val: Vec<f64>, pub int_val: Vec<i32>, pub string_val: Vec<Vec<u8>>, pub scomplex_val: Vec<f32>, pub int64_val: Vec<i64>, pub bool_val: Vec<bool>, pub dcomplex_val: Vec<f64>, pub resource_handle_val: Vec<ResourceHandleProto>, pub variant_val: Vec<VariantTensorDataProto>, pub uint32_val: Vec<u32>, pub uint64_val: Vec<u64>,
}
Expand description

Protocol buffer representing a tensor.

Fields

dtype: i32tensor_shape: Option<TensorShapeProto>

Shape of the tensor. TODO(touts): sort out the 0-rank issues.

version_number: i32

Version number.

In version 0, if the “repeated xxx” representations contain only one element, that element is repeated to fill the shape. This makes it easy to represent a constant Tensor with a single value.

tensor_content: Vec<u8>

Serialized raw tensor content from either Tensor::AsProtoTensorContent or memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation can be used for all tensor types. The purpose of this representation is to reduce serialization overhead during RPC call by avoiding serialization of many repeated small items.

half_val: Vec<i32>

DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we’ll have some pointless zero padding for each value here.

float_val: Vec<f32>

DT_FLOAT.

double_val: Vec<f64>

DT_DOUBLE.

int_val: Vec<i32>

DT_INT32, DT_INT16, DT_INT8, DT_UINT8.

string_val: Vec<Vec<u8>>

DT_STRING

scomplex_val: Vec<f32>

DT_COMPLEX64. scomplex_val(2i) and scomplex_val(2i+1) are real and imaginary parts of i-th single precision complex.

int64_val: Vec<i64>

DT_INT64

bool_val: Vec<bool>

DT_BOOL

dcomplex_val: Vec<f64>

DT_COMPLEX128. dcomplex_val(2i) and dcomplex_val(2i+1) are real and imaginary parts of i-th double precision complex.

resource_handle_val: Vec<ResourceHandleProto>

DT_RESOURCE

variant_val: Vec<VariantTensorDataProto>

DT_VARIANT

uint32_val: Vec<u32>

DT_UINT32

uint64_val: Vec<u64>

DT_UINT64

Implementations

impl TensorProto[src]

pub fn dtype(&self) -> DataType[src]

Returns the enum value of dtype, or the default if the field is set to an invalid enum value.

pub fn set_dtype(&mut self, value: DataType)[src]

Sets dtype to the provided enum value.

Trait Implementations

impl Clone for TensorProto[src]

fn clone(&self) -> TensorProto[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 TensorProto[src]

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

Formats the value using the given formatter. Read more

impl Default for TensorProto[src]

fn default() -> Self[src]

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

impl From<TensorProto> for AttrValue[src]

fn from(t: TensorProto) -> AttrValue[src]

Performs the conversion.

impl Message for TensorProto[src]

fn encode_raw<B>(&self, buf: &mut B) where
    B: BufMut
[src]

fn merge_field<B>(
    &mut self,
    tag: u32,
    wire_type: WireType,
    buf: &mut B,
    ctx: DecodeContext
) -> Result<(), DecodeError> where
    B: Buf
[src]

fn encoded_len(&self) -> usize[src]

Returns the encoded length of the message without a length delimiter.

fn clear(&mut self)[src]

Clears the message, resetting all fields to their default.

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
    B: BufMut
[src]

Encodes the message to a buffer. Read more

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
    B: BufMut
[src]

Encodes the message with a length-delimiter to a buffer. Read more

fn decode<B>(buf: B) -> Result<Self, DecodeError> where
    Self: Default,
    B: Buf
[src]

Decodes an instance of the message from a buffer. Read more

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
    Self: Default,
    B: Buf
[src]

Decodes a length-delimited instance of the message from the buffer.

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
    B: Buf
[src]

Decodes an instance of the message from a buffer, and merges it into self. Read more

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
    B: Buf
[src]

Decodes a length-delimited instance of the message from buffer, and merges it into self. Read more

impl PartialEq<TensorProto> for TensorProto[src]

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

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

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

This method tests for !=.

impl<'a> TryFrom<&'a Tensor> for TensorProto[src]

type Error = TractError

The type returned in the event of a conversion error.

fn try_from(from: &Tensor) -> TractResult<TensorProto>[src]

Performs the conversion.

impl<'a> TryFrom<&'a TensorProto> for Tensor[src]

type Error = TractError

The type returned in the event of a conversion error.

fn try_from(t: &TensorProto) -> TractResult<Tensor>[src]

Performs the conversion.

impl StructuralPartialEq for TensorProto[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.