Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::ResourceSparseApplyKerasMomentum
#include <training_ops.h>
Update relevant entries in '*var' and '*accum' according to the momentum scheme.
Summary
Set use_nesterov = True if you want to use Nesterov momentum.
That is for rows we have grad for, we update var and accum as follows:
accum = accum * momentum - lr * grad var += accum
Args:
- scope: A Scope object
- var: Should be from a Variable().
- accum: Should be from a Variable().
- lr: Learning rate. Must be a scalar.
- grad: The gradient.
- indices: A vector of indices into the first dimension of var and accum.
- momentum: Momentum. Must be a scalar.
Optional attributes (see Attrs
):
- use_locking: If
True
, updating of the var and accum tensors will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.
- use_nesterov: If
True
, the tensor passed to compute grad will be var + momentum * accum, so in the end, the var you get is actually var + momentum * accum.
Returns:
Constructors and Destructors
|
ResourceSparseApplyKerasMomentum(const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input momentum)
|
ResourceSparseApplyKerasMomentum(const ::tensorflow::Scope & scope, ::tensorflow::Input var, ::tensorflow::Input accum, ::tensorflow::Input lr, ::tensorflow::Input grad, ::tensorflow::Input indices, ::tensorflow::Input momentum, const ResourceSparseApplyKerasMomentum::Attrs & attrs)
|
Public attributes
Public functions
operator::tensorflow::Operation
operator::tensorflow::Operation() const
Public static functions
UseLocking
Attrs UseLocking(
bool x
)
UseNesterov
Attrs UseNesterov(
bool x
)
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. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tensorflow::ops::ResourceSparseApplyKerasMomentum Class Reference\n\ntensorflow::ops::ResourceSparseApplyKerasMomentum\n=================================================\n\n`#include \u003ctraining_ops.h\u003e`\n\nUpdate relevant entries in '\\*var' and '\\*accum' according to the momentum scheme.\n\nSummary\n-------\n\nSet use_nesterov = True if you want to use Nesterov momentum.\n\nThat is for rows we have grad for, we update var and accum as follows:\n\naccum = accum \\* momentum - lr \\* grad var += accum\n\nArgs:\n\n- scope: A [Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- var: Should be from a Variable().\n- accum: Should be from a Variable().\n- lr: Learning rate. Must be a scalar.\n- grad: The gradient.\n- indices: A vector of indices into the first dimension of var and accum.\n- momentum: Momentum. Must be a scalar.\n\n\u003cbr /\u003e\n\nOptional attributes (see [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/resource-sparse-apply-keras-momentum/attrs#structtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1_1_attrs)):\n\n- use_locking: If `True`, updating of the var and accum tensors will be protected by a lock; otherwise the behavior is undefined, but may exhibit less contention.\n- use_nesterov: If `True`, the tensor passed to compute grad will be var + momentum \\* accum, so in the end, the var you get is actually var + momentum \\* accum.\n\n\u003cbr /\u003e\n\nReturns:\n\n- the created [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation)\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [ResourceSparseApplyKerasMomentum](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1af5528208d48a551bfe3ecf447f27a8e0)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` var, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` accum, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` lr, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` grad, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` momentum)` ||\n| [ResourceSparseApplyKerasMomentum](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1a7afb417884c186a48f70dcfeac5d4394)`(const ::`[tensorflow::Scope](/versions/r2.14/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` var, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` accum, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` lr, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` grad, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` indices, ::`[tensorflow::Input](/versions/r2.14/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` momentum, const `[ResourceSparseApplyKerasMomentum::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/resource-sparse-apply-keras-momentum/attrs#structtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1_1_attrs)` & attrs)` ||\n\n| ### Public attributes ||\n|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1a58bc4e118977ebd79a8548322b20f7b9) | [Operation](/versions/r2.14/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n\n| ### Public functions ||\n|---------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [operator::tensorflow::Operation](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1a200379fccb879b6992be30ff8b702a3a)`() const ` | |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [UseLocking](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1a0ed18393806389dac75596ac30d2a7bc)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/resource-sparse-apply-keras-momentum/attrs#structtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1_1_attrs) |\n| [UseNesterov](#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1a87e697f5363e381c3318f6bb1223cdd4)`(bool x)` | [Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/resource-sparse-apply-keras-momentum/attrs#structtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum_1_1_attrs) |\n\n| ### Structs ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [tensorflow::ops::ResourceSparseApplyKerasMomentum::Attrs](/versions/r2.14/api_docs/cc/struct/tensorflow/ops/resource-sparse-apply-keras-momentum/attrs) | Optional attribute setters for [ResourceSparseApplyKerasMomentum](/versions/r2.14/api_docs/cc/class/tensorflow/ops/resource-sparse-apply-keras-momentum#classtensorflow_1_1ops_1_1_resource_sparse_apply_keras_momentum). |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\nPublic functions\n----------------\n\n### ResourceSparseApplyKerasMomentum\n\n```gdscript\n ResourceSparseApplyKerasMomentum(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input var,\n ::tensorflow::Input accum,\n ::tensorflow::Input lr,\n ::tensorflow::Input grad,\n ::tensorflow::Input indices,\n ::tensorflow::Input momentum\n)\n``` \n\n### ResourceSparseApplyKerasMomentum\n\n```gdscript\n ResourceSparseApplyKerasMomentum(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input var,\n ::tensorflow::Input accum,\n ::tensorflow::Input lr,\n ::tensorflow::Input grad,\n ::tensorflow::Input indices,\n ::tensorflow::Input momentum,\n const ResourceSparseApplyKerasMomentum::Attrs & attrs\n)\n``` \n\n### operator::tensorflow::Operation\n\n```gdscript\n operator::tensorflow::Operation() const \n``` \n\nPublic static functions\n-----------------------\n\n### UseLocking\n\n```text\nAttrs UseLocking(\n bool x\n)\n``` \n\n### UseNesterov\n\n```text\nAttrs UseNesterov(\n bool x\n)\n```"]]