pub struct CustomGradientRegistry<T, E> { /* private fields */ }Expand description
Registry for custom gradient functions
Implementations§
Source§impl<T, E> CustomGradientRegistry<T, E>
impl<T, E> CustomGradientRegistry<T, E>
pub fn new() -> Self
Sourcepub fn register<F>(&mut self, operation_name: String, backward_fn: F)
pub fn register<F>(&mut self, operation_name: String, backward_fn: F)
Register a custom backward function for an operation
Sourcepub fn get(&self, operation_name: &str) -> Option<&BackwardFn<T, E>>
pub fn get(&self, operation_name: &str) -> Option<&BackwardFn<T, E>>
Get custom gradient function for an operation
Sourcepub fn has_custom_gradient(&self, operation_name: &str) -> bool
pub fn has_custom_gradient(&self, operation_name: &str) -> bool
Check if custom gradient exists
Sourcepub fn unregister(&mut self, operation_name: &str) -> bool
pub fn unregister(&mut self, operation_name: &str) -> bool
Remove custom gradient
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<T, E> Freeze for CustomGradientRegistry<T, E>
impl<T, E> !RefUnwindSafe for CustomGradientRegistry<T, E>
impl<T, E> !Send for CustomGradientRegistry<T, E>
impl<T, E> !Sync for CustomGradientRegistry<T, E>
impl<T, E> Unpin for CustomGradientRegistry<T, E>
impl<T, E> !UnwindSafe for CustomGradientRegistry<T, E>
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