Struct datafusion::common::arrow::tensor::Tensor

source ·
pub struct Tensor<'a, T>{ /* private fields */ }
Expand description

Tensor of primitive types

Implementations§

source§

impl<'a, T> Tensor<'a, T>

source

pub fn try_new( buffer: Buffer, shape: Option<Vec<usize>>, strides: Option<Vec<usize>>, names: Option<Vec<&'a str>>, ) -> Result<Tensor<'a, T>, ArrowError>

Creates a new Tensor

source

pub fn new_row_major( buffer: Buffer, shape: Option<Vec<usize>>, names: Option<Vec<&'a str>>, ) -> Result<Tensor<'a, T>, ArrowError>

Creates a new Tensor using row major memory layout

source

pub fn new_column_major( buffer: Buffer, shape: Option<Vec<usize>>, names: Option<Vec<&'a str>>, ) -> Result<Tensor<'a, T>, ArrowError>

Creates a new Tensor using column major memory layout

source

pub fn data_type(&self) -> &DataType

The data type of the Tensor

source

pub fn shape(&self) -> Option<&Vec<usize>>

The sizes of the dimensions

source

pub fn data(&self) -> &Buffer

Returns a reference to the underlying Buffer

source

pub fn strides(&self) -> Option<&Vec<usize>>

The number of bytes between elements in each dimension

source

pub fn names(&self) -> Option<&Vec<&'a str>>

The names of the dimensions

source

pub fn ndim(&self) -> usize

The number of dimensions

source

pub fn dim_name(&self, i: usize) -> Option<&'a str>

The name of dimension i

source

pub fn size(&self) -> usize

The total number of elements in the Tensor

source

pub fn is_contiguous(&self) -> Result<bool, ArrowError>

Indicates if the data is laid out contiguously in memory

source

pub fn is_row_major(&self) -> Result<bool, ArrowError>

Indicates if the memory layout row major

source

pub fn is_column_major(&self) -> Result<bool, ArrowError>

Indicates if the memory layout column major

Trait Implementations§

source§

impl<'a, T> Debug for Tensor<'a, T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for Tensor<'a, T>

§

impl<'a, T> RefUnwindSafe for Tensor<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Tensor<'a, T>
where T: Send,

§

impl<'a, T> Sync for Tensor<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Tensor<'a, T>
where T: Unpin,

§

impl<'a, T> UnwindSafe for Tensor<'a, T>
where T: UnwindSafe,

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, 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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> Allocation for T
where T: RefUnwindSafe + Send + Sync,