pub struct NpzTensors { /* private fields */ }
Expand description
Lazy tensor loader.
Implementations§
source§impl NpzTensors
impl NpzTensors
pub fn new<T: AsRef<Path>>(path: T) -> Result<Self>
pub fn names(&self) -> Vec<&String>
sourcepub fn get_shape_and_dtype(&self, name: &str) -> Result<(Shape, DType)>
pub fn get_shape_and_dtype(&self, name: &str) -> Result<(Shape, DType)>
This only returns the shape and dtype for a named tensor. Compared to get
, this avoids
reading the whole tensor data.
pub fn get(&self, name: &str) -> Result<Option<Tensor>>
Trait Implementations§
source§impl SimpleBackend for NpzTensors
impl SimpleBackend for NpzTensors
source§fn get(
&self,
s: Shape,
name: &str,
_: Init,
dtype: DType,
dev: &Device,
) -> Result<Tensor>
fn get( &self, s: Shape, name: &str, _: Init, dtype: DType, dev: &Device, ) -> Result<Tensor>
Retrieve a tensor based on a target name and shape.
source§fn get_unchecked(
&self,
name: &str,
dtype: DType,
dev: &Device,
) -> Result<Tensor>
fn get_unchecked( &self, name: &str, dtype: DType, dev: &Device, ) -> Result<Tensor>
Retrieve a tensor based on the name.
fn contains_tensor(&self, name: &str) -> bool
Auto Trait Implementations§
impl Freeze for NpzTensors
impl RefUnwindSafe for NpzTensors
impl Send for NpzTensors
impl Sync for NpzTensors
impl Unpin for NpzTensors
impl UnwindSafe for NpzTensors
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> 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