pub struct CubeTensor<R>where
R: CubeRuntime,{
pub client: ComputeClient<<R as Runtime>::Server>,
pub handle: Handle,
pub shape: Shape,
pub device: <R as Runtime>::Device,
pub strides: Vec<usize>,
pub dtype: DType,
pub qparams: Option<QParams<QParamTensor>>,
}Expand description
The basic tensor primitive struct.
Fields§
§client: ComputeClient<<R as Runtime>::Server>Compute client for the runtime.
handle: HandleThe buffer where the data are stored.
shape: ShapeThe shape of the tensor.
device: <R as Runtime>::DeviceThe device of the tensor.
strides: Vec<usize>The strides of the tensor.
dtype: DTypeThe datatype of the tensor.
qparams: Option<QParams<QParamTensor>>Runtime quantization parameters, if applicable
Implementations§
Source§impl<R> CubeTensor<R>where
R: CubeRuntime,
impl<R> CubeTensor<R>where
R: CubeRuntime,
Sourcepub fn new(
client: ComputeClient<<R as Runtime>::Server>,
handle: Handle,
shape: Shape,
device: <R as Runtime>::Device,
strides: Vec<usize>,
dtype: DType,
) -> CubeTensor<R>
pub fn new( client: ComputeClient<<R as Runtime>::Server>, handle: Handle, shape: Shape, device: <R as Runtime>::Device, strides: Vec<usize>, dtype: DType, ) -> CubeTensor<R>
Create a new standard tensor
Sourcepub fn new_contiguous(
client: ComputeClient<<R as Runtime>::Server>,
device: <R as Runtime>::Device,
shape: Shape,
handle: Handle,
dtype: DType,
) -> CubeTensor<R>
pub fn new_contiguous( client: ComputeClient<<R as Runtime>::Server>, 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>,
device: <R as Runtime>::Device,
) -> CubeTensor<R>
pub fn to_client( &self, client: ComputeClient<<R as Runtime>::Server>, 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).
Source§impl<R> CubeTensor<R>where
R: CubeRuntime,
impl<R> CubeTensor<R>where
R: CubeRuntime,
Sourcepub fn new_quantized(
client: ComputeClient<<R as Runtime>::Server>,
handle: Handle,
shape: Shape,
device: <R as Runtime>::Device,
strides: Vec<usize>,
dtype: DType,
qparams: QParams<QParamTensor>,
) -> CubeTensor<R>
pub fn new_quantized( client: ComputeClient<<R as Runtime>::Server>, handle: Handle, shape: Shape, device: <R as Runtime>::Device, strides: Vec<usize>, dtype: DType, qparams: QParams<QParamTensor>, ) -> CubeTensor<R>
Create a new quantized tensor
Sourcepub fn quantized_handles(&self) -> Option<(CubeTensor<R>, CubeTensor<R>)>
pub fn quantized_handles(&self) -> Option<(CubeTensor<R>, CubeTensor<R>)>
Returns the two tensors: (values, params) for a quantized tensor.
Sourcepub fn scales(&self) -> Option<CubeTensor<R>>
pub fn scales(&self) -> Option<CubeTensor<R>>
Construct a separate tensor for the quantization scales, if present
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§fn acc_precision(&self) -> QuantAcc
fn acc_precision(&self) -> QuantAcc
Source§fn propagation(&self) -> QuantPropagation
fn propagation(&self) -> QuantPropagation
Source§fn default_scheme() -> QuantScheme
fn default_scheme() -> 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