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

Function _TensorArraySplitGrad

tensorflow/python/ops/tensor_array_grad.py:230–248  ·  view source on GitHub ↗

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

(op, flow)

Source from the content-addressed store, hash-verified

228@ops.RegisterGradient("TensorArraySplitV2")
229@ops.RegisterGradient("TensorArraySplitV3")
230def _TensorArraySplitGrad(op, flow):
231 """Gradient for TensorArraySplit.
232
233 Args:
234 op: Forward TensorArraySplit op.
235 flow: Gradient `Tensor` flow to TensorArraySplit.
236
237 Returns:
238 A grad `Tensor`, the gradient created in upstream ReadGrads or PackGrad.
239 """
240 handle = op.inputs[0]
241 dtype = op.get_attr("T")
242 grad_source = _GetGradSource(flow)
243 g = (tensor_array_ops.TensorArray(dtype=dtype, handle=handle, flow=flow,
244 colocate_with_first_write_call=False)
245 .grad(source=grad_source, flow=flow))
246 grad = g.concat()
247 # handle, value, lengths, flow_in
248 return [None, grad, None, flow]

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected