Struct tract_tensorflow::tfpb::tensorflow::TensorProto
source · [−]pub struct TensorProto {Show 17 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: i32Version 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
Trait Implementations
sourceimpl Clone for TensorProto
impl Clone for TensorProto
sourcefn clone(&self) -> TensorProto
fn clone(&self) -> TensorProto
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for TensorProto
impl Debug for TensorProto
sourceimpl Default for TensorProto
impl Default for TensorProto
sourceimpl From<TensorProto> for AttrValue
impl From<TensorProto> for AttrValue
sourcefn from(t: TensorProto) -> AttrValue
fn from(t: TensorProto) -> AttrValue
Converts to this type from the input type.
sourceimpl Message for TensorProto
impl Message for TensorProto
sourcefn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
sourcefn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
Encodes the message to a buffer. Read more
sourcefn encode_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn encode_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Encodes the message to a newly allocated buffer.
sourcefn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError> where
B: BufMut,
Encodes the message with a length-delimiter to a buffer. Read more
sourcefn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Encodes the message with a length-delimiter to a newly allocated buffer.
sourcefn decode<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
fn decode<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
Decodes an instance of the message from a buffer. Read more
sourcefn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError> where
B: Buf,
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
sourcefn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
Decodes an instance of the message from a buffer, and merges it into self. Read more
sourcefn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError> where
B: Buf,
Decodes a length-delimited instance of the message from buffer, and
merges it into self. Read more
sourceimpl PartialEq<TensorProto> for TensorProto
impl PartialEq<TensorProto> for TensorProto
sourcefn eq(&self, other: &TensorProto) -> bool
fn eq(&self, other: &TensorProto) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &TensorProto) -> bool
fn ne(&self, other: &TensorProto) -> bool
This method tests for !=.
sourceimpl<'a> TryFrom<&'a Tensor> for TensorProto
impl<'a> TryFrom<&'a Tensor> for TensorProto
sourcefn try_from(from: &Tensor) -> TractResult<TensorProto>
fn try_from(from: &Tensor) -> TractResult<TensorProto>
Performs the conversion.
sourceimpl<'a> TryFrom<&'a TensorProto> for Tensor
impl<'a> TryFrom<&'a TensorProto> for Tensor
sourcefn try_from(t: &TensorProto) -> TractResult<Tensor>
fn try_from(t: &TensorProto) -> TractResult<Tensor>
Performs the conversion.
impl StructuralPartialEq for TensorProto
Auto Trait Implementations
impl RefUnwindSafe for TensorProto
impl Send for TensorProto
impl Sync for TensorProto
impl Unpin for TensorProto
impl UnwindSafe for TensorProto
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?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;
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>ⓘNotable traits for Box<W, Global>impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?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;
W: Write + ?Sized, impl<R> Read for Box<R, Global> where
R: Read + ?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
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
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
fn as_any(&self) -> &(dyn Any + 'static)
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
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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