Skip to content

opto.optimizers.optimizer

AbstractOptimizer

AbstractOptimizer(
    parameters: List[ParameterNode], *args, **kwargs
)

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

parameters instance-attribute

parameters = parameters

propagator property

propagator

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

step

step()

Update the parameters based on the feedback.

zero_feedback

zero_feedback()

Reset the feedback.

Optimizer

Optimizer(
    parameters: List[ParameterNode],
    *args,
    propagator: Propagator = None,
    **kwargs
)

Bases: AbstractOptimizer

Optimizer based on Trace graph.

propagator property

propagator

trace_graph property

trace_graph

Aggregate the graphs of all the parameters.

step

step(bypassing=False, *args, **kwargs)

project

project(update_dict: Dict[ParameterNode, Any])

Project the update dictionary onto the feasible set.

propose

propose(*args, **kwargs)

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

update

update(update_dict: Dict[ParameterNode, Any])

Update the trainable parameters given a dictionary of new data.

zero_feedback

zero_feedback()

default_propagator

default_propagator()

Return the default Propagator object of the optimizer.

backward

backward(node: Node, *args, **kwargs)

Propagate the feedback backward.

save

save(path: str)

Save the optimizer state to a file.

load

load(path: str)

Load the optimizer state from a file.