pub trait IntoModuleValueAndGrad<'a, M, Args, Val, Err>where
M: ModuleParameters + 'a,
Args: Clone,{
// Required method
fn into_module_value_and_grad(
self,
) -> impl FnMut(&mut M, Args) -> Result<(Val, FlattenedModuleParam), Exception> + 'a;
}
Expand description
Helper trait for value_and_grad
Required Methods§
Sourcefn into_module_value_and_grad(
self,
) -> impl FnMut(&mut M, Args) -> Result<(Val, FlattenedModuleParam), Exception> + 'a
fn into_module_value_and_grad( self, ) -> impl FnMut(&mut M, Args) -> Result<(Val, FlattenedModuleParam), Exception> + 'a
Computes the valud and gradient of the passed function f(model, args)
with regard to the
model’s trainable parameters.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.