pub struct TensorBlockRefMut<'a> { /* private fields */ }
Expand description
Mutable reference to a TensorBlock
Implementations§
Source§impl<'a> TensorBlockRefMut<'a>
impl<'a> TensorBlockRefMut<'a>
Sourcepub fn as_ref(&self) -> TensorBlockRef<'_>
pub fn as_ref(&self) -> TensorBlockRef<'_>
Get a non mutable reference to this block
Sourcepub fn data_mut(&mut self) -> TensorBlockDataMut<'_>
pub fn data_mut(&mut self) -> TensorBlockDataMut<'_>
Get all the data and metadata inside this TensorBlockRefMut
as a
struct with separate fields, to allow borrowing them separately.
Sourcepub fn values_mut(&mut self) -> ArrayRefMut<'_>
pub fn values_mut(&mut self) -> ArrayRefMut<'_>
Get a mutable reference to the values in this block
Sourcepub fn components(&self) -> Vec<Labels>
pub fn components(&self) -> Vec<Labels>
Get the components for this block
Sourcepub fn properties(&self) -> Labels
pub fn properties(&self) -> Labels
Get the properties for this block
Sourcepub fn gradient_mut(&mut self, parameter: &str) -> Option<TensorBlockRefMut<'_>>
pub fn gradient_mut(&mut self, parameter: &str) -> Option<TensorBlockRefMut<'_>>
Get a mutable reference to the data and metadata for the gradient with respect to the given parameter in this block, if it exists.
Sourcepub fn gradients_mut(&mut self) -> GradientsMutIter<'_> ⓘ
pub fn gradients_mut(&mut self) -> GradientsMutIter<'_> ⓘ
Get an iterator over parameter/TensorBlockRefMut
pairs for all gradients
in this block
Sourcepub fn save(&self, path: impl AsRef<Path>) -> Result<(), Error>
pub fn save(&self, path: impl AsRef<Path>) -> Result<(), Error>
Save the given block to the file at path
This is a convenience function calling crate::io::save_block
Sourcepub fn save_buffer(&self, buffer: &mut Vec<u8>) -> Result<(), Error>
pub fn save_buffer(&self, buffer: &mut Vec<u8>) -> Result<(), Error>
Save the given block to an in-memory buffer
This is a convenience function calling crate::io::save_block_buffer
Trait Implementations§
Source§impl<'a> Debug for TensorBlockRefMut<'a>
impl<'a> Debug for TensorBlockRefMut<'a>
impl Send for TensorBlockRefMut<'_>
impl Sync for TensorBlockRefMut<'_>
Auto Trait Implementations§
impl<'a> Freeze for TensorBlockRefMut<'a>
impl<'a> RefUnwindSafe for TensorBlockRefMut<'a>
impl<'a> Unpin for TensorBlockRefMut<'a>
impl<'a> !UnwindSafe for TensorBlockRefMut<'a>
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