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)
| 172 | @ops.RegisterGradient("TensorArrayScatterV2") |
| 173 | @ops.RegisterGradient("TensorArrayScatterV3") |
| 174 | def _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") |
nothing calls this directly
no test coverage detected