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