Enum decthings_api::tensor::DecthingsTensor
source · pub enum DecthingsTensor<'a> {
Show 16 variants
F32(CowArray<'a, f32, IxDyn>),
F64(CowArray<'a, f64, IxDyn>),
I8(CowArray<'a, i8, IxDyn>),
I16(CowArray<'a, i16, IxDyn>),
I32(CowArray<'a, i32, IxDyn>),
I64(CowArray<'a, i64, IxDyn>),
U8(CowArray<'a, u8, IxDyn>),
U16(CowArray<'a, u16, IxDyn>),
U32(CowArray<'a, u32, IxDyn>),
U64(CowArray<'a, u64, IxDyn>),
String(CowArray<'a, &'a str, IxDyn>),
Binary(CowArray<'a, &'a [u8], IxDyn>),
Boolean(CowArray<'a, bool, IxDyn>),
Image(CowArray<'a, DecthingsElementImage<'a>, IxDyn>),
Audio(CowArray<'a, DecthingsElementAudio<'a>, IxDyn>),
Video(CowArray<'a, DecthingsElementVideo<'a>, IxDyn>),
}
Variants§
F32(CowArray<'a, f32, IxDyn>)
F64(CowArray<'a, f64, IxDyn>)
I8(CowArray<'a, i8, IxDyn>)
I16(CowArray<'a, i16, IxDyn>)
I32(CowArray<'a, i32, IxDyn>)
I64(CowArray<'a, i64, IxDyn>)
U8(CowArray<'a, u8, IxDyn>)
U16(CowArray<'a, u16, IxDyn>)
U32(CowArray<'a, u32, IxDyn>)
U64(CowArray<'a, u64, IxDyn>)
String(CowArray<'a, &'a str, IxDyn>)
Binary(CowArray<'a, &'a [u8], IxDyn>)
Boolean(CowArray<'a, bool, IxDyn>)
Image(CowArray<'a, DecthingsElementImage<'a>, IxDyn>)
Audio(CowArray<'a, DecthingsElementAudio<'a>, IxDyn>)
Video(CowArray<'a, DecthingsElementVideo<'a>, IxDyn>)
Implementations§
source§impl<'a> DecthingsTensor<'a>
impl<'a> DecthingsTensor<'a>
pub fn view(&'a self) -> Self
pub fn shape(&self) -> &[usize]
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
sourcepub fn as_f64(self) -> Option<CowArray<'a, f64, IxDyn>>
pub fn as_f64(self) -> Option<CowArray<'a, f64, IxDyn>>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64), casts it to a float array.
Returns an array that is either owned or not. If the data was of type f64, the returned array is borrowed. Otherwise a new array is created, so the returned array is owned.
sourcepub fn as_f64_item(self) -> Option<f64>
pub fn as_f64_item(self) -> Option<f64>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64) with length 1, casts the single element to an f64 and returns it.
sourcepub fn as_i64(&'a self) -> Option<CowArray<'a, i64, IxDyn>>
pub fn as_i64(&'a self) -> Option<CowArray<'a, i64, IxDyn>>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64), cast it to an i64 array.
Returns an array that is either owned or not. If the data was of type i64, the returned array is borrowed. Otherwise a new array is created, so the returned array is owned.
sourcepub fn as_i64_item(self) -> Option<i64>
pub fn as_i64_item(self) -> Option<i64>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64) with length 1, casts the single element to an i64 and returns it.
sourcepub fn as_u64(&'a self) -> Option<CowArray<'a, u64, IxDyn>>
pub fn as_u64(&'a self) -> Option<CowArray<'a, u64, IxDyn>>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64), casts it to a u64. If the value is i8, i16, i32 or i64 and negative, None is returned.
sourcepub fn as_u64_item(self) -> Option<u64>
pub fn as_u64_item(self) -> Option<u64>
If this is a numeric type (f32, f64, u8, u16, u32, u64, i8, i16, i32 or i64) with length 1, casts the single element to an u64 and returns it.
sourcepub fn as_str_item(&self) -> Option<&str>
pub fn as_str_item(&self) -> Option<&str>
If this is a string type with length 1, returns the string.
sourcepub fn as_binary_item(&self) -> Option<&[u8]>
pub fn as_binary_item(&self) -> Option<&[u8]>
If this is a binary type with length 1, returns the binary.
sourcepub fn as_boolean_item(&self) -> Option<bool>
pub fn as_boolean_item(&self) -> Option<bool>
If this is a boolean type with length 1, returns the boolean.
sourcepub fn as_image_item(&self) -> Option<&DecthingsElementImage<'_>>
pub fn as_image_item(&self) -> Option<&DecthingsElementImage<'_>>
If this is an image type with length 1, returns the image.
sourcepub fn as_audio_item(&self) -> Option<&DecthingsElementAudio<'_>>
pub fn as_audio_item(&self) -> Option<&DecthingsElementAudio<'_>>
If this is a audio type with length 1, returns the audio.
sourcepub fn as_video_item(&self) -> Option<&DecthingsElementVideo<'_>>
pub fn as_video_item(&self) -> Option<&DecthingsElementVideo<'_>>
If this is a video type with length 1, returns the video.
pub fn serialize(&self) -> Vec<u8>
Trait Implementations§
source§impl<'a> Clone for DecthingsTensor<'a>
impl<'a> Clone for DecthingsTensor<'a>
source§fn clone(&self) -> DecthingsTensor<'a>
fn clone(&self) -> DecthingsTensor<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more