Skip to main content

empty_like

Function empty_like 

Source
pub fn empty_like<T: Element, D: Dimension>(
    other: &Array<T, D>,
) -> UninitArray<T, D>
Expand description

Create an uninitialized array with the same shape (and element type) as other.

Analogous to numpy.empty_like(). Returns a UninitArray that the caller must fully initialize before calling UninitArray::assume_init. Avoids the memset that zeros_like / full_like incur when the caller is about to overwrite every element anyway.