Struct metatensor::TensorBlockRef
source · pub struct TensorBlockRef<'a> { /* private fields */ }
Expand description
Reference to a TensorBlock
Implementations§
source§impl<'a> TensorBlockRef<'a>
impl<'a> TensorBlockRef<'a>
sourcepub fn data(&'a self) -> TensorBlockData<'a>
pub fn data(&'a self) -> TensorBlockData<'a>
Get all the data and metadata inside this TensorBlockRef
as a
struct with separate fields, to allow borrowing them separately.
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_list(&self) -> Vec<&'a str>
pub fn gradient_list(&self) -> Vec<&'a str>
Get the full list of gradients in this block
sourcepub fn gradient(&self, parameter: &str) -> Option<TensorBlockRef<'a>>
pub fn gradient(&self, parameter: &str) -> Option<TensorBlockRef<'a>>
Get the data and metadata for the gradient with respect to the given parameter in this block, if it exists.
sourcepub fn try_clone(&self) -> Result<TensorBlock, Error>
pub fn try_clone(&self) -> Result<TensorBlock, Error>
Clone this block, cloning all the data and metadata contained inside.
This can fail if the external data held inside an mts_array_t
can not
be cloned.
sourcepub fn gradients(&self) -> GradientsIter<'_> ⓘ
pub fn gradients(&self) -> GradientsIter<'_> ⓘ
Get an iterator over parameter/TensorBlockRef
pairs for all gradients in
this block
Trait Implementations§
source§impl<'a> Clone for TensorBlockRef<'a>
impl<'a> Clone for TensorBlockRef<'a>
source§fn clone(&self) -> TensorBlockRef<'a>
fn clone(&self) -> TensorBlockRef<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for TensorBlockRef<'a>
impl<'a> Debug for TensorBlockRef<'a>
impl<'a> Copy for TensorBlockRef<'a>
impl<'a> Send for TensorBlockRef<'a>
impl<'a> Sync for TensorBlockRef<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for TensorBlockRef<'a>
impl<'a> Unpin for TensorBlockRef<'a>
impl<'a> UnwindSafe for TensorBlockRef<'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