pub struct HostArray { /* private fields */ }Expand description
An array in host memory: a typed buffer and a shape.
Implementations§
Source§impl HostArray
impl HostArray
Sourcepub fn from_vec<T>(data: Vec<T>, shape: impl Into<Shape>) -> HostArraywhere
T: Element,
pub fn from_vec<T>(data: Vec<T>, shape: impl Into<Shape>) -> HostArraywhere
T: Element,
Creates an array from its elements in row-major order.
§Panics
Panics if the number of elements does not match the shape.
Sourcepub fn full(shape: impl Into<Shape>, dtype: DType, value: Value) -> HostArray
pub fn full(shape: impl Into<Shape>, dtype: DType, value: Value) -> HostArray
An array filled with value, converted to dtype.
Sourcepub fn into_buffer(self) -> Buffer
pub fn into_buffer(self) -> Buffer
Returns the buffer, consuming the array.
Sourcepub fn convert(&self, dtype: DType) -> HostArray
pub fn convert(&self, dtype: DType) -> HostArray
Returns the array with its elements converted to dtype.
Trait Implementations§
impl StructuralPartialEq for HostArray
Auto Trait Implementations§
impl Freeze for HostArray
impl RefUnwindSafe for HostArray
impl Send for HostArray
impl Sync for HostArray
impl Unpin for HostArray
impl UnsafeUnpin for HostArray
impl UnwindSafe for HostArray
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