Update `ref` by subtracting `value` from 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.subtract`, this op does not broadcast. `ref` and `value` must have the same shape. Args: ref:
(ref, value, use_locking=None, name=None)
| 149 | |
| 150 | @tf_export(v1=["assign_sub"]) |
| 151 | def assign_sub(ref, value, use_locking=None, name=None): |
| 152 | """Update `ref` by subtracting `value` from it. |
| 153 | |
| 154 | This operation outputs `ref` after the update is done. |
| 155 | This makes it easier to chain operations that need to use the reset value. |
| 156 | Unlike `tf.math.subtract`, this op does not broadcast. `ref` and `value` |
| 157 | must have the same shape. |
| 158 | |
| 159 | Args: |
| 160 | ref: A mutable `Tensor`. Must be one of the following types: `float32`, |
| 161 | `float64`, `int64`, `int32`, `uint8`, `uint16`, `int16`, `int8`, |
| 162 | `complex64`, `complex128`, `qint8`, `quint8`, `qint32`, `half`. Should be |
| 163 | from a `Variable` node. |
| 164 | value: A `Tensor`. Must have the same shape and dtype as `ref`. The value to |
| 165 | be subtracted to the variable. |
| 166 | use_locking: An optional `bool`. Defaults to `False`. If True, the |
| 167 | subtraction will be protected by a lock; otherwise the behavior is |
| 168 | undefined, but may exhibit less contention. |
| 169 | name: A name for the operation (optional). |
| 170 | |
| 171 | Returns: |
| 172 | Same as "ref". Returned as a convenience for operations that want |
| 173 | to use the new value after the variable has been updated. |
| 174 | """ |
| 175 | if ref.dtype._is_ref_dtype: |
| 176 | return gen_state_ops.assign_sub( |
| 177 | ref, value, use_locking=use_locking, name=name) |
| 178 | return ref.assign_sub(value) |
| 179 | |
| 180 | |
| 181 | @tf_export(v1=["assign_add"]) |
nothing calls this directly
no test coverage detected