Skip to content

Commit

Permalink
Update inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
elftausend committed Oct 7, 2024
1 parent 57db83e commit 99d36a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ build
.externalNativeBuild
/captures
*.txt
flamegraph*
5 changes: 4 additions & 1 deletion src/modules/autograd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl<'a, Mods: Module<'a, D>, D: Device + 'a> Module<'a, D> for Autograd<'a, Mod
}

impl<'dev, Mods> Autograd<'dev, Mods> {
#[inline]
pub fn register_no_grad_buf<T, D, S>(&self, buf: &Buffer<T, D, S>)
where
T: Unit + 'static,
Expand Down Expand Up @@ -165,14 +164,17 @@ where
}

impl<'dev, Mods> GradActions for Autograd<'dev, Mods> {
#[inline]
unsafe fn gradients(&self) -> Option<&crate::Gradients> {
Some(unsafe { &(*self.grads.get()) })
}

#[inline]
unsafe fn gradients_mut(&self) -> Option<&mut crate::Gradients> {
Some(unsafe { &mut (*self.grads.get()) })
}

#[inline]
unsafe fn grad<
'a,
T: 'static,
Expand All @@ -186,6 +188,7 @@ impl<'dev, Mods> GradActions for Autograd<'dev, Mods> {
unsafe { (*self.grads.get()).get_ref(device, buf.id()) }
}

#[inline]
unsafe fn grad_mut<
'a,
T: 'static,
Expand Down

0 comments on commit 99d36a0

Please sign in to comment.