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

Function build_ta_with_new_flow

tensorflow/python/ops/tensor_array_ops.py:1199–1227  ·  view source on GitHub ↗

Builds a TensorArray with a new `flow` tensor.

(old_ta, flow)

Source from the content-addressed store, hash-verified

1197
1198
1199def build_ta_with_new_flow(old_ta, flow):
1200 """Builds a TensorArray with a new `flow` tensor."""
1201 # Sometimes we get old_ta as the implementation, sometimes it's the
1202 # TensorArray wrapper object.
1203 impl = (old_ta._implementation if isinstance(old_ta, TensorArray)
1204 else old_ta)
1205
1206 if not context.executing_eagerly():
1207 if (not isinstance(impl, _GraphTensorArrayV2) and
1208 control_flow_util.EnableControlFlowV2(ops.get_default_graph())):
1209 raise NotImplementedError("Attempting to build a graph-mode TF2-style "
1210 "TensorArray from either an eager-mode "
1211 "TensorArray or a TF1-style TensorArray. "
1212 "This is not currently supported. You may be "
1213 "attempting to capture a TensorArray "
1214 "inside a tf.function or tf.data map function. "
1215 "Instead, construct a new TensorArray inside "
1216 "the function.")
1217 new_ta = TensorArray(
1218 dtype=impl.dtype,
1219 handle=impl.handle,
1220 flow=flow,
1221 infer_shape=impl._infer_shape,
1222 colocate_with_first_write_call=impl._colocate_with_first_write_call)
1223 new_impl = new_ta._implementation
1224 new_impl._dynamic_size = impl._dynamic_size
1225 new_impl._colocate_with = impl._colocate_with
1226 new_impl._element_shape = impl._element_shape # Share _element_shape.
1227 return new_ta
1228
1229# pylint: enable=protected-access
1230

Callers 9

identityMethod · 0.85
writeMethod · 0.85
scatterMethod · 0.85
splitMethod · 0.85
identityMethod · 0.85
writeMethod · 0.85
unstackMethod · 0.85
scatterMethod · 0.85
splitMethod · 0.85

Calls 2

executing_eagerlyMethod · 0.80
TensorArrayClass · 0.70

Tested by

no test coverage detected