Python tensorflow.python.ops.resource_variable_ops.resource_scatter_add() Examples
The following are 30
code examples of tensorflow.python.ops.resource_variable_ops.resource_scatter_add().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tensorflow.python.ops.resource_variable_ops
, or try the search function
.
Example #1
Source File: qhm.py From qhoptim with MIT License | 6 votes |
def _resource_apply_sparse(self, grad, var, indices): momentum_buffer = self.get_slot(var, "momentum") learning_rate = math_ops.cast(self._learning_rate_tensor, var.dtype.base_dtype) momentum = math_ops.cast(self._momentum_tensor, var.dtype.base_dtype) nu = math_ops.cast(self._nu_tensor, var.dtype.base_dtype) momentum_op = training_ops.resource_sparse_apply_momentum( var.handle, momentum_buffer.handle, nu * (1.0 - momentum) * learning_rate, grad, indices, momentum, use_locking=self._use_locking, use_nesterov=False, ) with ops.control_dependencies([momentum_op]): delta = (nu - 1.0) * learning_rate * grad gd_op = resource_variable_ops.resource_scatter_add(var.handle, indices, delta) return control_flow_ops.group(momentum_op, gd_op)
Example #2
Source File: lamb_optimizer_v1.py From training with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #3
Source File: AMSGrad.py From DCRNN with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #4
Source File: adamW.py From Conditional_Density_Estimation with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v, _=None): # last argument allows for one overflow argument, to have the same function # signature as state_ops.scatter_add with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #5
Source File: opt.py From EMNLP2018_NLI with GNU General Public License v3.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #6
Source File: opt.py From EMNLP2018_NLI with GNU General Public License v3.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #7
Source File: AMSGrad.py From PhysNet with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #8
Source File: AdaBound.py From AdaBound-Tensorflow with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x, i, v)]): return x.value()
Example #9
Source File: optimizer.py From bert-multitask-learning with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add( x.handle, i, v)]): return x.value()
Example #10
Source File: lamb_optimizer_v1.py From training with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #11
Source File: multi_gpu_optimizer.py From uda with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add( x.handle, i, v)]): return x.value()
Example #12
Source File: AMSGrad.py From AMSGrad-Tensorflow with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #13
Source File: weight_decay_optimizers.py From robust_audio_ae with BSD 2-Clause "Simplified" License | 5 votes |
def _resource_scatter_add(self, x, i, v, _=None): # last argument allows for one overflow argument, to have the same function # signature as state_ops.scatter_add with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #14
Source File: RAdam.py From RAdam-Tensorflow with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies([resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #15
Source File: training.py From keras-radam with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies([resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #16
Source File: optimization_gpu.py From BERT-multi-gpu with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add( x.handle, i, v)]): return x.value()
Example #17
Source File: adam.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add( x.handle, i, v)]): return x.value()
Example #18
Source File: gradient_descent.py From Serverless-Deep-Learning-with-TensorFlow-and-AWS-Lambda with MIT License | 5 votes |
def _resource_apply_sparse_duplicate_indices(self, grad, handle, indices): return resource_variable_ops.resource_scatter_add( handle.handle, indices, -grad * self._learning_rate)
Example #19
Source File: gradient_descent.py From keras-lambda with MIT License | 5 votes |
def _resource_apply_sparse(self, grad, handle, indices): return resource_variable_ops.resource_scatter_add( handle, indices, -grad * self._learning_rate)
Example #20
Source File: adam_weight_decay_utils.py From BERT with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v, _=None): # last argument allows for one overflow argument, to have the same function # signature as state_ops.scatter_add with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #21
Source File: amsgrad.py From HyperGAN with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #22
Source File: adam.py From lambda-packs with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add( x.handle, i, v)]): return x.value()
Example #23
Source File: gradient_descent.py From lambda-packs with MIT License | 5 votes |
def _resource_apply_sparse_duplicate_indices(self, grad, handle, indices): return resource_variable_ops.resource_scatter_add( handle.handle, indices, -grad * self._learning_rate)
Example #24
Source File: gradient_descent.py From auto-alt-text-lambda-api with MIT License | 5 votes |
def _resource_apply_sparse(self, grad, handle, indices): return resource_variable_ops.resource_scatter_add( handle, indices, -grad * self._learning_rate)
Example #25
Source File: multistep_with_adamoptimizer.py From tensor2tensor with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with tf.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #26
Source File: lamb_utils.py From BERT with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies([resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #27
Source File: radam_utils.py From BERT with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies([resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #28
Source File: adam_weight_decay_exclude_utils.py From BERT with Apache License 2.0 | 5 votes |
def _resource_scatter_add(self, x, i, v, _=None): # last argument allows for one overflow argument, to have the same function # signature as state_ops.scatter_add with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #29
Source File: AMSGrad.py From scGAN with MIT License | 5 votes |
def _resource_scatter_add(self, x, i, v): with ops.control_dependencies( [resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value()
Example #30
Source File: qhadam.py From qhoptim with MIT License | 5 votes |
def _resource_apply_sparse(self, grad, var, indices): def resource_scatter_add(x, i, v): with ops.control_dependencies([resource_variable_ops.resource_scatter_add(x.handle, i, v)]): return x.value() return self._apply_sparse_shared(grad, var, indices, resource_scatter_add)