pub struct CubeTensor<R: CubeRuntime> {
pub client: ComputeClient<R::Server, R::Channel>,
pub handle: Handle,
pub shape: Shape,
pub device: R::Device,
pub strides: Vec<usize>,
pub dtype: DType,
}Expand description
The basic tensor primitive struct.
Fields§
§client: ComputeClient<R::Server, R::Channel>Compute client for the runtime.
handle: HandleThe buffer where the data are stored.
shape: ShapeThe shape of the tensor.
device: R::DeviceThe device of the tensor.
strides: Vec<usize>The strides of the tensor.
dtype: DTypeThe datatype of the tensor.
Implementations§
Source§impl<R: CubeRuntime> CubeTensor<R>
impl<R: CubeRuntime> CubeTensor<R>
Source§impl<R> CubeTensor<R>where
R: CubeRuntime,
impl<R> CubeTensor<R>where
R: CubeRuntime,
Sourcepub fn new_contiguous(
client: ComputeClient<R::Server, R::Channel>,
device: R::Device,
shape: Shape,
handle: Handle,
dtype: DType,
) -> Self
pub fn new_contiguous( client: ComputeClient<R::Server, R::Channel>, device: R::Device, shape: Shape, handle: Handle, dtype: DType, ) -> Self
Create a new tensor with a contiguous memory layout.
Sourcepub fn to_client(
&self,
client: ComputeClient<R::Server, R::Channel>,
device: R::Device,
) -> Self
pub fn to_client( &self, client: ComputeClient<R::Server, R::Channel>, device: R::Device, ) -> Self
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: CubeElement>(
&'a self,
line_size: u8,
) -> TensorArg<'a, R>
pub fn as_tensor_arg<'a, E: CubeElement>( &'a self, line_size: u8, ) -> TensorArg<'a, R>
Return the reference to a tensor argument.
Sourcepub fn as_array_arg<E: CubeElement>(&self, vectorisation: u8) -> ArrayArg<'_, R>
pub fn as_array_arg<E: CubeElement>(&self, vectorisation: u8) -> ArrayArg<'_, R>
Return the reference to an array argument.
Sourcepub fn assert_is_on_same_device(&self, other: &Self)
pub fn assert_is_on_same_device(&self, other: &Self)
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§impl<R> Debug for CubeTensor<R>where
R: CubeRuntime,
impl<R> Debug for CubeTensor<R>where
R: CubeRuntime,
Source§impl<R: CubeRuntime> From<CubeTensor<R>> for CubeFusionHandle<R>
Available on crate feature fusion only.
impl<R: CubeRuntime> From<CubeTensor<R>> for CubeFusionHandle<R>
fusion only.Source§fn from(value: CubeTensor<R>) -> Self
fn from(value: CubeTensor<R>) -> Self
Source§impl<R: CubeRuntime, E: CubeElement> From<CubeTensor<R>> for TensorHandle<R, E>
impl<R: CubeRuntime, E: CubeElement> From<CubeTensor<R>> for TensorHandle<R, E>
Source§fn from(val: CubeTensor<R>) -> Self
fn from(val: CubeTensor<R>) -> Self
Source§impl<R: CubeRuntime> QTensorPrimitive for CubeTensor<R>
impl<R: CubeRuntime> QTensorPrimitive for CubeTensor<R>
Source§fn scheme(&self) -> &QuantScheme
fn scheme(&self) -> &QuantScheme
Source§impl<R: CubeRuntime> TensorMetadata for CubeTensor<R>
impl<R: CubeRuntime> TensorMetadata for CubeTensor<R>
impl<R: CubeRuntime> AutotuneOutput for CubeTensor<R>
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