opto.optimizers.optimizer#

Module Contents#

Classes#

AbstractOptimizer

An optimizer is responsible for updating the parameters based on the feedback.

Optimizer

API#

class AbstractOptimizer(parameters: List[opto.trace.nodes.ParameterNode], *args, **kwargs)[source]#

An optimizer is responsible for updating the parameters based on the feedback.

Initialization

abstract step()[source]#

Update the parameters based on the feedback.

abstract zero_feedback()[source]#

Reset the feedback.

abstract property propagator#

Return a Propagator object that can be used to propagate feedback in backward.

class Optimizer(parameters: List[opto.trace.nodes.ParameterNode], *args, propagator: opto.trace.propagators.propagators.Propagator = None, **kwargs)[source]#

Bases: opto.optimizers.optimizer.AbstractOptimizer

property propagator#
property trace_graph#

Aggregate the graphs of all the parameters.

step(*args, **kwargs)[source]#
propose(*args, **kwargs)[source]#

Propose the new data of the parameters based on the feedback.

update(update_dict: Dict[opto.trace.nodes.ParameterNode, Any])[source]#

Update the trainable parameters given a dictionary of new data.

zero_feedback()[source]#
default_propagator()[source]#

Return the default Propagator object of the optimizer.

backward(node: opto.trace.nodes.Node, *args, **kwargs)[source]#

Propagate the feedback backward.