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

Method grad

tensorflow/python/ops/tensor_array_ops.py:224–247  ·  view source on GitHub ↗

See TensorArray.

(self, source, flow=None, name=None)

Source from the content-addressed store, hash-verified

222 return build_ta_with_new_flow(self, flow)
223
224 def grad(self, source, flow=None, name=None):
225 """See TensorArray."""
226 # tensor_array_grad requires a flow input when forward
227 # TensorArrays are dynamically sized. This forces the creation
228 # of the grad TensorArray only once the final forward array's size
229 # is fixed.
230 if flow is None:
231 flow = self.flow
232 with ops.name_scope(name, "TensorArrayGrad", [self._handle]):
233 with ops.colocate_with(self._handle):
234 g_handle, unused_flow = gen_data_flow_ops.tensor_array_grad_v3(
235 handle=self._handle, source=source, flow_in=flow, name=name)
236 with ops.control_dependencies([g_handle]):
237 flow = array_ops.identity(flow, name="gradient_flow")
238 g = TensorArray(
239 dtype=self._dtype,
240 handle=g_handle,
241 flow=flow,
242 infer_shape=self._infer_shape,
243 colocate_with_first_write_call=False)
244 # pylint: disable=protected-access
245 g._implementation._element_shape = self._element_shape
246 # pylint: enable=protected-access
247 return g
248
249 def read(self, index, name=None):
250 """See TensorArray."""

Callers

nothing calls this directly

Calls 5

colocate_withMethod · 0.80
TensorArrayClass · 0.70
name_scopeMethod · 0.45
control_dependenciesMethod · 0.45
identityMethod · 0.45

Tested by

no test coverage detected