Struct VirtualTensor

Source
pub struct VirtualTensor<E: Numeric, IO = Read> { /* private fields */ }
Expand description

Tensor representation that is decoupled from how the tensor is stored.

Implementations§

Source§

impl<E: Numeric, IO: Clone> VirtualTensor<E, IO>

Source

pub fn as_tensor_map(&self) -> TensorMap<E>

Source

pub fn as_slice(&self, start: u32, end: u32) -> Slice<Line<E>>

Source

pub fn shape(&self, axis: u32) -> u32

Get the shape of the tensor at the given axis.

Source

pub fn stride(&self, axis: u32) -> u32

Get the stride of the tensor at the given axis.

Source

pub fn rank(&self) -> u32

Get the rank of the tensor.

Source

pub fn len(&self) -> u32

Source

pub fn buffer_len(&self) -> u32

Source

pub fn __expand_as_tensor_map( context: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <TensorMap<E> as CubeType>::ExpandType

Source

pub fn __expand_as_slice( context: &mut Scope, this: <Self as CubeType>::ExpandType, start: <u32 as CubeType>::ExpandType, end: <u32 as CubeType>::ExpandType, ) -> <Slice<Line<E>> as CubeType>::ExpandType

Source

pub fn __expand_shape( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_stride( scope: &mut Scope, this: <Self as CubeType>::ExpandType, axis: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_rank( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_len( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source

pub fn __expand_buffer_len( scope: &mut Scope, this: <Self as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source§

impl<E: Numeric, IO: Clone> VirtualTensor<E, IO>

Source

pub fn coordinate(&self, index: u32, dim: u32) -> u32

Source

pub fn __expand_coordinate( scope: &mut Scope, this: <Self as CubeType>::ExpandType, index: <u32 as CubeType>::ExpandType, dim: <u32 as CubeType>::ExpandType, ) -> <u32 as CubeType>::ExpandType

Source§

impl<E: Numeric> VirtualTensor<E, Read>

Source

pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &V) -> Self

Create a new read only virtual tensor.

Source

pub fn __expand_new<V>( _scope: &mut Scope, v: V::ExpandType, ) -> VirtualTensorExpand<E, Read>

Expand function of Self::new.

Source§

impl<E: Numeric> VirtualTensor<E, ReadWrite>

Source

pub fn new<V: VirtualTensorOperations<E> + 'static>(_v: &mut V) -> Self

Create a new read write virtual tensor.

Source

pub fn __expand_new<V>( _scope: &mut Scope, v: V::ExpandType, ) -> VirtualTensorExpand<E, ReadWrite>

Expand function of Self::new.

Trait Implementations§

Source§

impl<E: Clone + Numeric, IO: Clone> Clone for VirtualTensor<E, IO>

Source§

fn clone(&self) -> VirtualTensor<E, IO>

Returns a duplicate 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<E: Numeric, IO: Clone> CubeType for VirtualTensor<E, IO>

Source§

type ExpandType = VirtualTensorExpand<E, IO>

Source§

fn into_mut(scope: &mut Scope, expand: Self::ExpandType) -> Self::ExpandType

Wrapper around the init method, necessary to type inference.
Source§

impl<E: Numeric, IO: Clone> List<Line<E>> for VirtualTensor<E, IO>

Source§

fn __expand_read( scope: &mut Scope, this: VirtualTensorExpand<E, IO>, index: <u32 as CubeType>::ExpandType, ) -> <Line<E> as CubeType>::ExpandType

Source§

fn read(&self, index: u32) -> T

Source§

fn read_unchecked(&self, index: u32) -> T

Source§

fn __expand_read_unchecked( scope: &mut Scope, this: Self::ExpandType, index: ExpandElementTyped<u32>, ) -> <T as CubeType>::ExpandType

Source§

impl<E: Numeric> ListMut<Line<E>> for VirtualTensor<E, ReadWrite>

Source§

fn __expand_write( scope: &mut Scope, this: VirtualTensorExpand<E, ReadWrite>, index: <u32 as CubeType>::ExpandType, value: <Line<E> as CubeType>::ExpandType, ) -> <() as CubeType>::ExpandType

Source§

fn write(&self, index: u32, value: T)

Source§

impl<E: Numeric, IO: Clone> Copy for VirtualTensor<E, IO>

Auto Trait Implementations§

§

impl<E, IO> Freeze for VirtualTensor<E, IO>

§

impl<E, IO> RefUnwindSafe for VirtualTensor<E, IO>

§

impl<E, IO> Send for VirtualTensor<E, IO>
where IO: Send,

§

impl<E, IO> Sync for VirtualTensor<E, IO>
where IO: Sync,

§

impl<E, IO> Unpin for VirtualTensor<E, IO>
where E: Unpin, IO: Unpin,

§

impl<E, IO> UnwindSafe for VirtualTensor<E, IO>
where E: UnwindSafe, IO: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

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

Source§

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

Source§

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