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: 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

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

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

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 !=.

Serialize this value into the given Serde serializer. 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.

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.

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.

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.

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.

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

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 alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.