NAME

Peta::NN::Optimizer - SGD with momentum, and Adam

VERSION

version 0.2610090

SYNOPSIS

my $opt = Peta::NN::Optimizer->new(kind => 'adam', lr => 0.005,
                                   backend => $backend, params => [ $net->params ]);
$opt->step(1 / $batch_size);

METHODS

new

kind is adam (default) or sgd; backend and params, a list of [holder, name], are required. lr, momentum, beta1, beta2, epsilon and weight_decay are optional.

step

step($scale): one update from the gradients the last backward pass left. $scale multiplies every gradient; 1/batch size turns a batch's summed gradient into its mean.

AUTHOR

PetaMem s.r.o. <info@petamem.com>

COPYRIGHT

Copyright (c) 2026 PetaMem s.r.o.

LICENSE

This package is free software, dual-licensed under the Artistic License 2.0 and the BSD 2-Clause License. See the LICENSE file of the distribution.