Struct tfrecord::protobuf::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: i32
tensor_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_UINT16, 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
sourceimpl TensorProto
impl TensorProto
sourceimpl TensorProto
impl TensorProto
pub fn from_slice<T, S>(shape: S, data: &[T]) -> Result<Self, Error> where
S: IntoShape,
T: TensorProtoElement,
pub fn from_byte_slices<T, S>(
shape: S,
data: &[T]
) -> Result<TensorProto, Error> where
S: IntoShape,
T: AsRef<[u8]>,
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<'de> Deserialize<'de> for TensorProto
impl<'de> Deserialize<'de> for TensorProto
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<S, D, T> From<&'_ ArrayBase<S, D>> for TensorProto where
D: Dimension,
S: RawData<Elem = T> + Data,
T: TensorProtoElement,
impl<S, D, T> From<&'_ ArrayBase<S, D>> for TensorProto where
D: Dimension,
S: RawData<Elem = T> + Data,
T: TensorProtoElement,
sourceimpl<S, D, T> From<ArrayBase<S, D>> for TensorProto where
D: Dimension,
S: RawData<Elem = T> + Data,
T: TensorProtoElement,
impl<S, D, T> From<ArrayBase<S, D>> for TensorProto where
D: Dimension,
S: RawData<Elem = T> + Data,
T: TensorProtoElement,
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>
fn encode_to_vec(&self) -> Vec<u8, Global>
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>
fn encode_length_delimited_to_vec(&self) -> Vec<u8, Global>
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 Serialize for TensorProto
impl Serialize for TensorProto
sourceimpl TryFrom<&'_ DynamicImage> for TensorProto
impl TryFrom<&'_ DynamicImage> for TensorProto
sourceimpl<T> TryFrom<&'_ FlatSamples<&'_ [T]>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<&'_ FlatSamples<&'_ [T]>> for TensorProto where
T: TensorProtoElement,
sourceimpl<T> TryFrom<&'_ FlatSamples<&'_ Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<&'_ FlatSamples<&'_ Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
sourceimpl<T> TryFrom<&'_ FlatSamples<Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<&'_ FlatSamples<Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
sourceimpl<P, C, T> TryFrom<&'_ ImageBuffer<P, C>> for TensorProto where
P: 'static + Pixel<Subpixel = T>,
C: Deref<Target = [P::Subpixel]> + AsRef<[P::Subpixel]>,
T: 'static + TensorProtoElement + Primitive,
impl<P, C, T> TryFrom<&'_ ImageBuffer<P, C>> for TensorProto where
P: 'static + Pixel<Subpixel = T>,
C: Deref<Target = [P::Subpixel]> + AsRef<[P::Subpixel]>,
T: 'static + TensorProtoElement + Primitive,
sourceimpl TryFrom<&'_ Tensor> for TensorProto
impl TryFrom<&'_ Tensor> for TensorProto
sourceimpl TryFrom<DynamicImage> for TensorProto
impl TryFrom<DynamicImage> for TensorProto
sourceimpl<T> TryFrom<FlatSamples<&'_ [T]>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<FlatSamples<&'_ [T]>> for TensorProto where
T: TensorProtoElement,
sourceimpl<T> TryFrom<FlatSamples<&'_ Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<FlatSamples<&'_ Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
sourceimpl<T> TryFrom<FlatSamples<Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
impl<T> TryFrom<FlatSamples<Vec<T, Global>>> for TensorProto where
T: TensorProtoElement,
sourceimpl<P, C, T> TryFrom<ImageBuffer<P, C>> for TensorProto where
P: 'static + Pixel<Subpixel = T>,
C: Deref<Target = [P::Subpixel]> + AsRef<[P::Subpixel]>,
T: 'static + TensorProtoElement + Primitive,
impl<P, C, T> TryFrom<ImageBuffer<P, C>> for TensorProto where
P: 'static + Pixel<Subpixel = T>,
C: Deref<Target = [P::Subpixel]> + AsRef<[P::Subpixel]>,
T: 'static + TensorProtoElement + Primitive,
sourceimpl TryFrom<Tensor> for TensorProto
impl TryFrom<Tensor> for TensorProto
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> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for P where
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian()
.
sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian()
.
sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian()
.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more