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

Function inplace_add

tensorflow/python/ops/inplace_ops.py:198–221  ·  view source on GitHub ↗

Applies an inplace add on input x at index i with value v. Note that this function is not actually inplace - it allocates a copy of x. The utility is not avoiding memory copies but rather specifying a sparse update. If i is None, x and v must be the same shape. Computes y = x; y += v;

(x, i, v)

Source from the content-addressed store, hash-verified

196 ('Prefer tf.tensor_scatter_nd_add, which offers the same functionality '
197 'with well-defined read-write semantics.'))
198def inplace_add(x, i, v):
199 """Applies an inplace add on input x at index i with value v.
200
201 Note that this function is not actually inplace - it allocates
202 a copy of x. The utility is not avoiding memory copies but rather
203 specifying a sparse update.
204
205 If i is None, x and v must be the same shape. Computes
206 y = x; y += v;
207 If i is a scalar, x has a rank 1 higher than v's. Computes
208 y = x; y[i, :] += v;
209 Otherwise, x and v must have the same rank. Computes
210 y = x; y[i, :] += v;
211
212 Args:
213 x: A Tensor.
214 i: None, a scalar or a vector.
215 v: A Tensor.
216
217 Returns:
218 Returns y, which is guaranteed not to be an alias of x.
219
220 """
221 return alias_inplace_add(gen_array_ops.deep_copy(x), i, v)
222
223
224@deprecation.deprecated(

Callers

nothing calls this directly

Calls 1

alias_inplace_addFunction · 0.85

Tested by

no test coverage detected