pub struct CandleStorage { /* private fields */ }Expand description
Candle-backed tensor storage - the primary storage implementation
Implementations§
Source§impl CandleStorage
impl CandleStorage
Sourcepub fn new(tensor: CandleTensor) -> Self
pub fn new(tensor: CandleTensor) -> Self
Create from a Candle tensor
Sourcepub fn tensor(&self) -> &CandleTensor
pub fn tensor(&self) -> &CandleTensor
Get the underlying Candle tensor
Sourcepub fn tensor_mut(&mut self) -> &mut CandleTensor
pub fn tensor_mut(&mut self) -> &mut CandleTensor
Get a mutable reference to the Candle tensor
Sourcepub fn zeros(shape: &[usize], dtype: DataType, device: &Device) -> Result<Self>
pub fn zeros(shape: &[usize], dtype: DataType, device: &Device) -> Result<Self>
Create zeros tensor with Candle
Sourcepub fn ones(shape: &[usize], dtype: DataType, device: &Device) -> Result<Self>
pub fn ones(shape: &[usize], dtype: DataType, device: &Device) -> Result<Self>
Create ones tensor with Candle
Trait Implementations§
Source§impl Clone for CandleStorage
impl Clone for CandleStorage
Source§fn clone(&self) -> CandleStorage
fn clone(&self) -> CandleStorage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CandleStorage
impl Debug for CandleStorage
Source§impl TensorStorage for CandleStorage
impl TensorStorage for CandleStorage
Source§fn data_ptr_mut(&mut self) -> *mut u8
fn data_ptr_mut(&mut self) -> *mut u8
Get mutable data pointer (for unsafe operations)
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Get data size in bytes
Source§fn to_device(&self, device: &Device) -> Result<Arc<dyn TensorStorage>>
fn to_device(&self, device: &Device) -> Result<Arc<dyn TensorStorage>>
Copy data to another device
Source§fn clone_storage(&self) -> Arc<dyn TensorStorage> ⓘ
fn clone_storage(&self) -> Arc<dyn TensorStorage> ⓘ
Clone the storage
Source§fn as_candle_tensor(&self) -> Option<&CandleTensor>
fn as_candle_tensor(&self) -> Option<&CandleTensor>
Try to get the underlying Candle tensor (if this is CandleStorage)
Auto Trait Implementations§
impl !RefUnwindSafe for CandleStorage
impl !UnwindSafe for CandleStorage
impl Freeze for CandleStorage
impl Send for CandleStorage
impl Sync for CandleStorage
impl Unpin for CandleStorage
impl UnsafeUnpin for CandleStorage
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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 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>
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