pub struct CubeTensor<R>where
R: CubeRuntime,{
pub client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>,
pub handle: Handle,
pub shape: Shape,
pub device: <R as Runtime>::Device,
pub strides: Vec<usize>,
pub dtype: DType,
}
Expand description
The basic tensor primitive struct.
Fields§
§client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>
Compute client for the runtime.
handle: Handle
The buffer where the data are stored.
shape: Shape
The shape of the tensor.
device: <R as Runtime>::Device
The device of the tensor.
strides: Vec<usize>
The strides of the tensor.
dtype: DType
The datatype of the tensor.
Implementations§
Source§impl<R> CubeTensor<R>where
R: CubeRuntime,
impl<R> CubeTensor<R>where
R: CubeRuntime,
Source§impl<R> CubeTensor<R>where
R: CubeRuntime,
impl<R> CubeTensor<R>where
R: CubeRuntime,
Sourcepub fn new_contiguous(
client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>,
device: <R as Runtime>::Device,
shape: Shape,
handle: Handle,
dtype: DType,
) -> CubeTensor<R>
pub fn new_contiguous( client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>, device: <R as Runtime>::Device, shape: Shape, handle: Handle, dtype: DType, ) -> CubeTensor<R>
Create a new tensor with a contiguous memory layout.
Sourcepub fn to_client(
&self,
client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>,
device: <R as Runtime>::Device,
) -> CubeTensor<R>
pub fn to_client( &self, client: ComputeClient<<R as Runtime>::Server, <R as Runtime>::Channel>, device: <R as Runtime>::Device, ) -> CubeTensor<R>
Change the context of the current tensor and return the newly transferred tensor.
Sourcepub fn as_handle_ref(&self) -> TensorHandleRef<'_, R>
pub fn as_handle_ref(&self) -> TensorHandleRef<'_, R>
Return the reference to a tensor handle.
Sourcepub fn as_tensor_arg<'a, E>(&'a self, line_size: u8) -> TensorArg<'a, R>where
E: CubeElement,
pub fn as_tensor_arg<'a, E>(&'a self, line_size: u8) -> TensorArg<'a, R>where
E: CubeElement,
Return the reference to a tensor argument.
Sourcepub fn as_array_arg<E>(&self, vectorisation: u8) -> ArrayArg<'_, R>where
E: CubeElement,
pub fn as_array_arg<E>(&self, vectorisation: u8) -> ArrayArg<'_, R>where
E: CubeElement,
Return the reference to an array argument.
Sourcepub fn copy(&self) -> CubeTensor<R>
pub fn copy(&self) -> CubeTensor<R>
Copy the current tensor.
Sourcepub fn assert_is_on_same_device(&self, other: &CubeTensor<R>)
pub fn assert_is_on_same_device(&self, other: &CubeTensor<R>)
Assert that both tensors are on the same device.
Sourcepub fn is_contiguous(&self) -> bool
pub fn is_contiguous(&self) -> bool
Check if the current tensor is contiguous.
A tensor is contiguous if the elements are stored in memory if the strides in non-increasing order and the strides at position k is equal to the product of the shapes at all positions greater than k. However, all axes with a shape of 1 are ignored.
Sourcepub fn is_contiguous_buffer(&self) -> bool
pub fn is_contiguous_buffer(&self) -> bool
Check if the current tensor has a contiguous backing buffer (no overlap and no empty memory regions within the shape).
Trait Implementations§
Source§impl<R> Clone for CubeTensor<R>where
R: CubeRuntime,
impl<R> Clone for CubeTensor<R>where
R: CubeRuntime,
Source§fn clone(&self) -> CubeTensor<R>
fn clone(&self) -> CubeTensor<R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<R> Debug for CubeTensor<R>where
R: CubeRuntime,
impl<R> Debug for CubeTensor<R>where
R: CubeRuntime,
Source§impl<R> QTensorPrimitive for CubeTensor<R>where
R: CubeRuntime,
impl<R> QTensorPrimitive for CubeTensor<R>where
R: CubeRuntime,
Source§fn scheme(&self) -> &QuantScheme
fn scheme(&self) -> &QuantScheme
Source§impl<R> TensorMetadata for CubeTensor<R>where
R: CubeRuntime,
impl<R> TensorMetadata for CubeTensor<R>where
R: CubeRuntime,
impl<R> AutotuneOutput for CubeTensor<R>where
R: CubeRuntime,
Auto Trait Implementations§
impl<R> Freeze for CubeTensor<R>
impl<R> !RefUnwindSafe for CubeTensor<R>
impl<R> Send for CubeTensor<R>
impl<R> Sync for CubeTensor<R>
impl<R> Unpin for CubeTensor<R>
impl<R> !UnwindSafe for CubeTensor<R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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