MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / assign_add

Function assign_add

tensorflow/python/ops/state_ops.py:182–209  ·  view source on GitHub ↗

Update `ref` by adding `value` to it. This operation outputs "ref" after the update is done. This makes it easier to chain operations that need to use the reset value. Unlike `tf.math.add`, this op does not broadcast. `ref` and `value` must have the same shape. Args: ref: A mutable `

(ref, value, use_locking=None, name=None)

Source from the content-addressed store, hash-verified

180
181@tf_export(v1=["assign_add"])
182def assign_add(ref, value, use_locking=None, name=None):
183 """Update `ref` by adding `value` to it.
184
185 This operation outputs "ref" after the update is done.
186 This makes it easier to chain operations that need to use the reset value.
187 Unlike `tf.math.add`, this op does not broadcast. `ref` and `value` must have
188 the same shape.
189
190 Args:
191 ref: A mutable `Tensor`. Must be one of the following types: `float32`,
192 `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`,
193 `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. Should be
194 from a `Variable` node.
195 value: A `Tensor`. Must have the same shape and dtype as `ref`. The value to
196 be added to the variable.
197 use_locking: An optional `bool`. Defaults to `False`. If True, the addition
198 will be protected by a lock; otherwise the behavior is undefined, but may
199 exhibit less contention.
200 name: A name for the operation (optional).
201
202 Returns:
203 Same as "ref". Returned as a convenience for operations that want
204 to use the new value after the variable has been updated.
205 """
206 if ref.dtype._is_ref_dtype:
207 return gen_state_ops.assign_add(
208 ref, value, use_locking=use_locking, name=name)
209 return ref.assign_add(value)
210
211
212@tf_export(v1=["assign"])

Callers 2

TESTFunction · 0.85
TESTFunction · 0.85

Calls 1

assign_addMethod · 0.45

Tested by 2

TESTFunction · 0.68
TESTFunction · 0.68