(rontolisp) docs
← Functions

torch:optimizer

(torch:optimizer kind params fields step-fn)

Returns a fresh optimizer: kind is a keyword naming the rule, params a module (whose torch:parameters are walked) or a plain list of parameter tensors, fields a plist of KEYWORD/value hyper-parameters and state buffers, and step-fn a function called as (funcall step-fn optimizer) by torch:step. The step counter starts at 0.

This is how a user-written rule is spelled -- torch:sgd and torch:adam are ordinary callers of it. The step function reads its hyper-parameters back with torch:field and its parameters with torch:optimizer-params, so everything the rule needs lives in the record rather than in a closure.