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_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§

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

Sets dtype to the provided enum value.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Returns the encoded length of the message without a length delimiter.
Clears the message, resetting all fields to their default.
Encodes the message to a buffer. Read more
Encodes the message to a newly allocated buffer.
Encodes the message with a length-delimiter to a buffer. Read more
Encodes the message with a length-delimiter to a newly allocated buffer.
Decodes an instance of the message from a buffer. Read more
Decodes a length-delimited instance of the message from the buffer.
Decodes an instance of the message from a buffer, and merges it into self. Read more
Decodes a length-delimited instance of the message from buffer, and merges it into self. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
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
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
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
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
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

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.