tf.contrib.constrained_optimization.ConstrainedOptimizer
Stay organized with collections
Save and categorize content based on your preferences.
Base class representing a constrained optimizer.
tf.contrib.constrained_optimization.ConstrainedOptimizer(
optimizer
)
A ConstrainedOptimizer wraps a tf.compat.v1.train.Optimizer (or more than
one), and applies it to a ConstrainedMinimizationProblem. Unlike a
tf.compat.v1.train.Optimizer, which takes a tensor to minimize as a parameter
to its minimize() method, a constrained optimizer instead takes a
ConstrainedMinimizationProblem.
Args |
optimizer
|
tf.compat.v1.train.Optimizer, used to optimize the
ConstraintedMinimizationProblem.
|
Methods
minimize
View source
minimize(
minimization_problem, unconstrained_steps=None, global_step=None, var_list=None,
gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,
colocate_gradients_with_ops=False, name=None, grad_loss=None
)
Returns an Operation
for minimizing the constrained problem.
This method combines the functionality of minimize_unconstrained
and
minimize_constrained
. If global_step < unconstrained_steps, it will
perform an unconstrained update, and if global_step >= unconstrained_steps,
it will perform a constrained update.
The reason for this functionality is that it may be best to initialize the
constrained optimizer with an approximate optimum of the unconstrained
problem.
Returns |
Operation , the train_op.
|
Raises |
ValueError
|
If unconstrained_steps is provided, but global_step is not.
|
minimize_constrained
View source
minimize_constrained(
minimization_problem, global_step=None, var_list=None,
gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,
colocate_gradients_with_ops=False, name=None, grad_loss=None
)
Returns an Operation
for minimizing the constrained problem.
Unlike minimize_unconstrained
, this function attempts to find a solution
that minimizes the objective
portion of the minimization problem while
satisfying the constraints
portion.
Returns |
Operation , the train_op.
|
minimize_unconstrained
View source
minimize_unconstrained(
minimization_problem, global_step=None, var_list=None,
gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,
colocate_gradients_with_ops=False, name=None, grad_loss=None
)
Returns an Operation
for minimizing the unconstrained problem.
Unlike minimize_constrained
, this function ignores the constraints
(and
proxy_constraints
) portion of the minimization problem entirely, and only
minimizes objective
.
Returns |
Operation , the train_op.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.constrained_optimization.ConstrainedOptimizer\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/constrained_optimization/python/constrained_optimizer.py#L32-L279) |\n\nBase class representing a constrained optimizer. \n\n tf.contrib.constrained_optimization.ConstrainedOptimizer(\n optimizer\n )\n\nA ConstrainedOptimizer wraps a tf.compat.v1.train.Optimizer (or more than\none), and applies it to a ConstrainedMinimizationProblem. Unlike a\ntf.compat.v1.train.Optimizer, which takes a tensor to minimize as a parameter\nto its minimize() method, a constrained optimizer instead takes a\nConstrainedMinimizationProblem.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------|-------------------------------------------------------------------------------------|\n| `optimizer` | tf.compat.v1.train.Optimizer, used to optimize the ConstraintedMinimizationProblem. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-------------|--------------------------------------------------------------------------------------------------|\n| `optimizer` | Returns the [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer) used for optimization. |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `minimize`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/constrained_optimization/python/constrained_optimizer.py#L201-L279) \n\n minimize(\n minimization_problem, unconstrained_steps=None, global_step=None, var_list=None,\n gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,\n colocate_gradients_with_ops=False, name=None, grad_loss=None\n )\n\nReturns an `Operation` for minimizing the constrained problem.\n\nThis method combines the functionality of `minimize_unconstrained` and\n`minimize_constrained`. If global_step \\\u003c unconstrained_steps, it will\nperform an unconstrained update, and if global_step \\\u003e= unconstrained_steps,\nit will perform a constrained update.\n\nThe reason for this functionality is that it may be best to initialize the\nconstrained optimizer with an approximate optimum of the unconstrained\nproblem.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------------------------|----------------------------------------------------------------------------------------------------------------------|\n| `minimization_problem` | ConstrainedMinimizationProblem, the problem to optimize. |\n| `unconstrained_steps` | int, number of steps for which we should perform unconstrained updates, before transitioning to constrained updates. |\n| `global_step` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `var_list` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `gate_gradients` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `aggregation_method` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `colocate_gradients_with_ops` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `name` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `grad_loss` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `Operation`, the train_op. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|-------------------------------------------------------------|\n| `ValueError` | If unconstrained_steps is provided, but global_step is not. |\n\n\u003cbr /\u003e\n\n### `minimize_constrained`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/constrained_optimization/python/constrained_optimizer.py#L93-L145) \n\n minimize_constrained(\n minimization_problem, global_step=None, var_list=None,\n gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,\n colocate_gradients_with_ops=False, name=None, grad_loss=None\n )\n\nReturns an `Operation` for minimizing the constrained problem.\n\nUnlike `minimize_unconstrained`, this function attempts to find a solution\nthat minimizes the `objective` portion of the minimization problem while\nsatisfying the `constraints` portion.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------------------------|------------------------------------------------------------------------------------------|\n| `minimization_problem` | ConstrainedMinimizationProblem, the problem to optimize. |\n| `global_step` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `var_list` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `gate_gradients` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `aggregation_method` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `colocate_gradients_with_ops` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `name` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `grad_loss` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `Operation`, the train_op. ||\n\n\u003cbr /\u003e\n\n### `minimize_unconstrained`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/constrained_optimization/python/constrained_optimizer.py#L147-L199) \n\n minimize_unconstrained(\n minimization_problem, global_step=None, var_list=None,\n gate_gradients=train_optimizer.Optimizer.GATE_OP, aggregation_method=None,\n colocate_gradients_with_ops=False, name=None, grad_loss=None\n )\n\nReturns an `Operation` for minimizing the unconstrained problem.\n\nUnlike `minimize_constrained`, this function ignores the `constraints` (and\n`proxy_constraints`) portion of the minimization problem entirely, and only\nminimizes `objective`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|-------------------------------|------------------------------------------------------------------------------------------|\n| `minimization_problem` | ConstrainedMinimizationProblem, the problem to optimize. |\n| `global_step` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `var_list` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `gate_gradients` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `aggregation_method` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `colocate_gradients_with_ops` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `name` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n| `grad_loss` | as in [`tf.compat.v1.train.Optimizer`](../../../tf/train/Optimizer)'s `minimize` method. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `Operation`, the train_op. ||\n\n\u003cbr /\u003e"]]