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

Function inplace_update

tensorflow/python/ops/inplace_ops.py:168–191  ·  view source on GitHub ↗

Applies an inplace update 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 =

(x, i, v)

Source from the content-addressed store, hash-verified

166 ('Prefer tf.tensor_scatter_nd_update, which offers the same functionality '
167 'with well-defined read-write semantics.'))
168def inplace_update(x, i, v):
169 """Applies an inplace update on input x at index i with value v.
170
171 Note that this function is not actually inplace - it allocates
172 a copy of x. The utility is not avoiding memory copies but rather
173 specifying a sparse update.
174
175 If i is None, x and v must be the same shape. Computes
176 y = x; y = v;
177 If i is a scalar, x has a rank 1 higher than v's. Computes
178 y = x; y[i, :] = v;
179 Otherwise, x and v must have the same rank. Computes
180 y = x; y[i, :] = v;
181
182 Args:
183 x: A Tensor.
184 i: None, a scalar or a vector.
185 v: A Tensor.
186
187 Returns:
188 Returns y, which is guaranteed not to be an alias of x.
189
190 """
191 return alias_inplace_update(gen_array_ops.deep_copy(x), i, v)
192
193
194@deprecation.deprecated(

Callers

nothing calls this directly

Calls 1

alias_inplace_updateFunction · 0.85

Tested by

no test coverage detected