pub struct EmptyArray { /* private fields */ }Expand description
An implementation of the Array trait without any data.
This only tracks the shape of the array.
Implementations§
Source§impl EmptyArray
impl EmptyArray
Sourcepub fn new(shape: Vec<usize>) -> EmptyArray
pub fn new(shape: Vec<usize>) -> EmptyArray
Create a new EmptyArray with the given shape.
Trait Implementations§
Source§impl Array for EmptyArray
impl Array for EmptyArray
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Get the array as a mutable
Any referenceSource§fn create(&self, shape: &[usize], _fill_value: MtsArray) -> Box<dyn Array>
fn create(&self, shape: &[usize], _fill_value: MtsArray) -> Box<dyn Array>
Create a new array with the same array origin, data type, and device as
the current one, but with the requested
shape. Read moreSource§fn shape(&self) -> Vec<usize>
fn shape(&self) -> Vec<usize>
Get the shape of the array. This can be empty if the array has no shape
(e.g. a scalar).
Source§fn swap_axes(&mut self, axis_1: usize, axis_2: usize)
fn swap_axes(&mut self, axis_1: usize, axis_2: usize)
Swap the axes
axis_1 and axis_2 in this arraySource§fn move_data(&mut self, _: &dyn Array, _: &[mts_data_movement_t])
fn move_data(&mut self, _: &dyn Array, _: &[mts_data_movement_t])
Source§fn dtype(&self) -> DLDataType
fn dtype(&self) -> DLDataType
Get the data type of this array. Read more
Source§fn as_dlpack(
&self,
_device: DLDevice,
_stream: Option<i64>,
_max_version: DLPackVersion,
) -> Result<DLPackTensor, Error>
fn as_dlpack( &self, _device: DLDevice, _stream: Option<i64>, _max_version: DLPackVersion, ) -> Result<DLPackTensor, Error>
Convert the array to a
DLPack tensor.
The returned pointer is owned by the caller (and cleaned up via its deleter).Source§fn from_dlpack(
&self,
_dlpack_tensor: DLPackTensor,
) -> Result<Box<dyn Array>, Error>
fn from_dlpack( &self, _dlpack_tensor: DLPackTensor, ) -> Result<Box<dyn Array>, Error>
Create a new array from a
DLPack tensor, taking ownership of the
tensor’s data.Source§impl Clone for EmptyArray
impl Clone for EmptyArray
Source§fn clone(&self) -> EmptyArray
fn clone(&self) -> EmptyArray
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EmptyArray
impl RefUnwindSafe for EmptyArray
impl Send for EmptyArray
impl Sync for EmptyArray
impl Unpin for EmptyArray
impl UnsafeUnpin for EmptyArray
impl UnwindSafe for EmptyArray
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