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

Function _TensorArrayScatterGrad

tensorflow/python/ops/tensor_array_grad.py:174–192  ·  view source on GitHub ↗

Gradient for TensorArrayScatter. Args: op: Forward TensorArrayScatter op. flow: Gradient `Tensor` flow to TensorArrayScatter. Returns: A grad `Tensor`, the gradient created in upstream ReadGrads or PackGrad.

(op, flow)

Source from the content-addressed store, hash-verified

172@ops.RegisterGradient("TensorArrayScatterV2")
173@ops.RegisterGradient("TensorArrayScatterV3")
174def _TensorArrayScatterGrad(op, flow):
175 """Gradient for TensorArrayScatter.
176
177 Args:
178 op: Forward TensorArrayScatter op.
179 flow: Gradient `Tensor` flow to TensorArrayScatter.
180
181 Returns:
182 A grad `Tensor`, the gradient created in upstream ReadGrads or PackGrad.
183 """
184 handle = op.inputs[0]
185 indices = op.inputs[1]
186 dtype = op.get_attr("T")
187 grad_source = _GetGradSource(flow)
188 g = (tensor_array_ops.TensorArray(dtype=dtype, handle=handle, flow=flow,
189 colocate_with_first_write_call=False)
190 .grad(source=grad_source, flow=flow))
191 grad = g.gather(indices)
192 return [None, None, grad, flow]
193
194
195@ops.RegisterGradient("TensorArrayConcat")

Callers

nothing calls this directly

Calls 5

_GetGradSourceFunction · 0.85
TensorArrayMethod · 0.80
get_attrMethod · 0.45
gradMethod · 0.45
gatherMethod · 0.45

Tested by

no test coverage detected