1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Optimizers and learning rate schedulers for training neural networks.
/// Learning rate schedulers.
pub use Adagrad;
pub use Adam;
pub use AdamW;
pub use RMSprop;
pub use ;
pub use SGD;
use Float;
/// An optimizer updates model parameters using their gradients.
///
/// # Examples
///
/// ```
/// # use scivex_nn::optim::{Optimizer, SGD};
/// # use scivex_nn::layer::{Linear, Layer};
/// # use scivex_nn::variable::Variable;
/// # use scivex_core::{Tensor, random::Rng};
/// let mut rng = Rng::new(42);
/// let layer = Linear::<f64>::new(2, 1, false, &mut rng);
/// let params = layer.parameters();
/// let mut opt = SGD::new(params, 0.01_f64);
/// opt.zero_grad();
/// opt.step();
/// ```