#[non_exhaustive]pub struct Tensor {Show 14 fields
pub dtype: DataType,
pub shape: Vec<i64>,
pub bool_val: Vec<bool>,
pub string_val: Vec<String>,
pub bytes_val: Vec<Bytes>,
pub float_val: Vec<f32>,
pub double_val: Vec<f64>,
pub int_val: Vec<i32>,
pub int64_val: Vec<i64>,
pub uint_val: Vec<u32>,
pub uint64_val: Vec<u64>,
pub list_val: Vec<Tensor>,
pub struct_val: HashMap<String, Tensor>,
pub tensor_val: Bytes,
/* private fields */
}Expand description
A tensor value type.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.dtype: DataTypeThe data type of tensor.
shape: Vec<i64>Shape of the tensor.
bool_val: Vec<bool>Type specific representations that make it easy to create tensor protos in all languages. Only the representation corresponding to “dtype” can be set. The values hold the flattened representation of the tensor in row major order.
string_val: Vec<String>§bytes_val: Vec<Bytes>§float_val: Vec<f32>§double_val: Vec<f64>§int_val: Vec<i32>§int64_val: Vec<i64>§uint_val: Vec<u32>§uint64_val: Vec<u64>§list_val: Vec<Tensor>A list of tensor values.
struct_val: HashMap<String, Tensor>A map of string to tensor.
tensor_val: BytesSerialized raw tensor content.
Implementations§
Source§impl Tensor
impl Tensor
pub fn new() -> Self
Sourcepub fn set_bool_val<T, V>(self, v: T) -> Self
pub fn set_bool_val<T, V>(self, v: T) -> Self
Sets the value of bool_val.
Sourcepub fn set_string_val<T, V>(self, v: T) -> Self
pub fn set_string_val<T, V>(self, v: T) -> Self
Sets the value of string_val.
Sourcepub fn set_bytes_val<T, V>(self, v: T) -> Self
pub fn set_bytes_val<T, V>(self, v: T) -> Self
Sets the value of bytes_val.
Sourcepub fn set_float_val<T, V>(self, v: T) -> Self
pub fn set_float_val<T, V>(self, v: T) -> Self
Sets the value of float_val.
Sourcepub fn set_double_val<T, V>(self, v: T) -> Self
pub fn set_double_val<T, V>(self, v: T) -> Self
Sets the value of double_val.
Sourcepub fn set_int_val<T, V>(self, v: T) -> Self
pub fn set_int_val<T, V>(self, v: T) -> Self
Sets the value of int_val.
Sourcepub fn set_int64_val<T, V>(self, v: T) -> Self
pub fn set_int64_val<T, V>(self, v: T) -> Self
Sets the value of int64_val.
Sourcepub fn set_uint_val<T, V>(self, v: T) -> Self
pub fn set_uint_val<T, V>(self, v: T) -> Self
Sets the value of uint_val.
Sourcepub fn set_uint64_val<T, V>(self, v: T) -> Self
pub fn set_uint64_val<T, V>(self, v: T) -> Self
Sets the value of uint64_val.
Sourcepub fn set_list_val<T, V>(self, v: T) -> Self
pub fn set_list_val<T, V>(self, v: T) -> Self
Sets the value of list_val.
Sourcepub fn set_struct_val<T, K, V>(self, v: T) -> Self
pub fn set_struct_val<T, K, V>(self, v: T) -> Self
Sets the value of struct_val.
Sourcepub fn set_tensor_val<T: Into<Bytes>>(self, v: T) -> Self
pub fn set_tensor_val<T: Into<Bytes>>(self, v: T) -> Self
Sets the value of tensor_val.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tensor
impl<'de> Deserialize<'de> for Tensor
Source§fn 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
impl StructuralPartialEq for Tensor
Auto Trait Implementations§
impl !Freeze for Tensor
impl RefUnwindSafe for Tensor
impl Send for Tensor
impl Sync for Tensor
impl Unpin for Tensor
impl UnwindSafe for Tensor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more