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>

source

pub fn view(&'a self) -> Self

source

pub fn shape(&self) -> &[usize]

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn as_str_item(&self) -> Option<&str>

If this is a string type with length 1, returns the string.

source

pub fn as_binary_item(&self) -> Option<&[u8]>

If this is a binary type with length 1, returns the binary.

source

pub fn as_boolean_item(&self) -> Option<bool>

If this is a boolean type with length 1, returns the boolean.

source

pub fn as_image_item(&self) -> Option<&DecthingsElementImage<'_>>

If this is an image type with length 1, returns the image.

source

pub fn as_audio_item(&self) -> Option<&DecthingsElementAudio<'_>>

If this is a audio type with length 1, returns the audio.

source

pub fn as_video_item(&self) -> Option<&DecthingsElementVideo<'_>>

If this is a video type with length 1, returns the video.

source

pub fn serialize(&self) -> Vec<u8>

Trait Implementations§

source§

impl<'a> Clone for DecthingsTensor<'a>

source§

fn clone(&self) -> DecthingsTensor<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for DecthingsTensor<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a OwnedDecthingsTensor> for DecthingsTensor<'a>

source§

fn from(value: &'a OwnedDecthingsTensor) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> Freeze for DecthingsTensor<'a>

§

impl<'a> RefUnwindSafe for DecthingsTensor<'a>

§

impl<'a> Send for DecthingsTensor<'a>

§

impl<'a> Sync for DecthingsTensor<'a>

§

impl<'a> Unpin for DecthingsTensor<'a>

§

impl<'a> UnwindSafe for DecthingsTensor<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more