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

Function inplace_sub

tensorflow/python/ops/inplace_ops.py:228–251  ·  view source on GitHub ↗

Applies an inplace sub 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

226 ('Prefer tf.tensor_scatter_nd_sub, which offers the same functionality '
227 'with well-defined read-write semantics.'))
228def inplace_sub(x, i, v):
229 """Applies an inplace sub on input x at index i with value v.
230
231 Note that this function is not actually inplace - it allocates
232 a copy of x. The utility is not avoiding memory copies but rather
233 specifying a sparse update.
234
235 If i is None, x and v must be the same shape. Computes
236 y = x; y -= v;
237 If i is a scalar, x has a rank 1 higher than v's. Computes
238 y = x; y[i, :] -= v;
239 Otherwise, x and v must have the same rank. Computes
240 y = x; y[i, :] -= v;
241
242 Args:
243 x: A Tensor.
244 i: None, a scalar or a vector.
245 v: A Tensor.
246
247 Returns:
248 Returns y, which is guaranteed not to be an alias of x.
249
250 """
251 return alias_inplace_sub(gen_array_ops.deep_copy(x), i, v)
252
253empty = gen_array_ops.empty

Callers

nothing calls this directly

Calls 1

alias_inplace_subFunction · 0.85

Tested by

no test coverage detected