pub struct GradientStore<S: BlockStore> { /* private fields */ }Expand description
Gradient store for managing gradients with delta encoding
Implementations§
Source§impl<S: BlockStore> GradientStore<S>
impl<S: BlockStore> GradientStore<S>
Sourcepub fn with_vcs(store: Arc<S>, vcs: Arc<VersionControl<S>>) -> Self
pub fn with_vcs(store: Arc<S>, vcs: Arc<VersionControl<S>>) -> Self
Create with version control integration
Sourcepub fn vcs(&self) -> Option<&Arc<VersionControl<S>>>
pub fn vcs(&self) -> Option<&Arc<VersionControl<S>>>
Get the version control system, if available
Sourcepub async fn store_gradient(
&self,
data: &[f32],
shape: Vec<usize>,
provenance: Option<ProvenanceMetadata>,
) -> Result<Cid>
pub async fn store_gradient( &self, data: &[f32], shape: Vec<usize>, provenance: Option<ProvenanceMetadata>, ) -> Result<Cid>
Store a gradient (full)
Sourcepub async fn store_gradient_delta(
&self,
base_cid: &Cid,
target: &[f32],
shape: Vec<usize>,
provenance: Option<ProvenanceMetadata>,
) -> Result<Cid>
pub async fn store_gradient_delta( &self, base_cid: &Cid, target: &[f32], shape: Vec<usize>, provenance: Option<ProvenanceMetadata>, ) -> Result<Cid>
Store a gradient as delta from base
Sourcepub async fn load_gradient(&self, cid: &Cid) -> Result<GradientData>
pub async fn load_gradient(&self, cid: &Cid) -> Result<GradientData>
Load a gradient and reconstruct if it’s a delta
Sourcepub fn reconstruct_gradient<'a>(
&'a self,
cid: &'a Cid,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'a>>
pub fn reconstruct_gradient<'a>( &'a self, cid: &'a Cid, ) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'a>>
Reconstruct full gradient from delta chain
Sourcepub async fn compute_compression_stats(
&self,
cid: &Cid,
) -> Result<CompressionStats>
pub async fn compute_compression_stats( &self, cid: &Cid, ) -> Result<CompressionStats>
Get compression statistics for a gradient chain
Auto Trait Implementations§
impl<S> Freeze for GradientStore<S>
impl<S> !RefUnwindSafe for GradientStore<S>
impl<S> Send for GradientStore<S>
impl<S> Sync for GradientStore<S>
impl<S> Unpin for GradientStore<S>
impl<S> !UnwindSafe for GradientStore<S>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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