Base class for interfaces with external optimization algorithms.
Subclass this and implement
_minimize in order to wrap a new optimization
ExternalOptimizerInterface should not be instantiated directly; instead use
__init__(loss, var_list=None, equalities=None, inequalities=None, **optimizer_kwargs)
Initialize a new interface instance.
loss: A scalar
Tensorto be minimized.
var_list: Optional list of
Variableobjects to update to minimize
loss. Defaults to the list of variables collected in the graph under the key
equalities: Optional list of equality constraint scalar
Tensors to be held equal to zero.
inequalities: Optional list of inequality constraint scalar
Tensors to be kept nonnegative. **optimizer_kwargs: Other subclass-specific keyword arguments.
minimize(session=None, feed_dict=None, fetches=None, step_callback=None, loss_callback=None)
Minimize a scalar
Variables subject to optimization are updated in-place at the end of optimization.
Note that this method does not just return a minimization
Optimizer.minimize(); instead it actually performs minimization by
executing commands to control a
feed_dict: A feed dict to be passed to calls to
fetches: A list of
Tensors to fetch and supply to
loss_callbackas positional arguments.
step_callback: A function to be called at each optimization step; arguments are the current values of all optimization variables flattened into a single vector.
loss_callback: A function to be called every time the loss and gradients are computed, with evaluated fetches supplied as positional arguments.