Note: Functions taking Tensor arguments can also take anything accepted by
tf.convert_to_tensor.
[TOC]
TensorArray operations.
Class wrapping dynamic-sized, per-time-step, write-once Tensor arrays.
This class is meant to be used with dynamic iteration primitives such as
while_loop and map_fn. It supports gradient back-propagation via special
"flow" control flow dependencies.
The reference to the TensorArray.
The flow Tensor forcing ops leading to this TensorArray state.
Read the value at location index in the TensorArray.
index: 0-D. int32 tensor with the index to read from.name: A name for the operation (optional).
The tensor at index index.
Pack the values of a Tensor in the TensorArray.
value: (N+1)-D. Tensor of typedtype. The Tensor to unpack.name: A name for the operation (optional).
A new TensorArray object with flow that ensures the unpack occurs. Use this object all for subsequent operations.
ValueError: if the shape inference fails.
Split the values of a Tensor into the TensorArray.
value: (N+1)-D. Tensor of typedtype. The Tensor to split.lengths: 1-D. int32 vector with the lengths to use when splittingvaluealong its first dimension.name: A name for the operation (optional).
A new TensorArray object with flow that ensures the split occurs. Use this object all for subsequent operations.
ValueError: if the shape inference fails.
Write value into index index of the TensorArray.
index: 0-D. int32 scalar with the index to write to.value: N-D. Tensor of typedtype. The Tensor to write to this index.name: A name for the operation (optional).
A new TensorArray object with flow that ensures the write occurs. Use this object all for subsequent operations.
ValueError: if there are more writers than specified.
Return the values in the TensorArray as a packed Tensor.
All of the values must have been written and their shapes must all match.
name: A name for the operation (optional).
All the tensors in the TensorArray packed into one tensor.
Return the values in the TensorArray as a concatenated Tensor.
All of the values must have been written, their ranks must match, and and their shapes must all match for all dimensions except the first.
name: A name for the operation (optional).
All the tensors in the TensorArray concatenated into one tensor.
tf.TensorArray.__init__(dtype, size=None, dynamic_size=None, clear_after_read=None, tensor_array_name=None, handle=None, flow=None, infer_shape=True, name=None) {#TensorArray.init}
Construct a new TensorArray or wrap an existing TensorArray handle.
A note about the parameter name:
The name of the TensorArray (even if passed in) is uniquified: each time
a new TensorArray is created at runtime it is assigned its own name for
the duration of the run. This avoids name collisions if a TensorArray
is created within a while_loop.
dtype: (required) data type of the TensorArray.size: (optional) int32 scalarTensor: the size of the TensorArray. Required if handle is not provided.dynamic_size: (optional) Python bool: If true, writes to the TensorArray can grow the TensorArray past its initial size. Default: False.clear_after_read: Boolean (optional, default: True). If True, clear TensorArray values after reading them. This disables read-many semantics, but allows early release of memory.tensor_array_name: (optional) Python string: the name of the TensorArray. This is used when creating the TensorArray handle. If this value is set, handle should be None.handle: (optional) ATensorhandle to an existing TensorArray. If this is set, tensor_array_name should be None.flow: (optional) A floatTensorscalar coming from an existingTensorArray.flow.infer_shape: (optional, default: True) If True, shape inference is enabled. In this case, all elements must have the same shape.name: A name for the operation (optional).
ValueError: if both handle and tensor_array_name are provided.TypeError: if handle is provided but is not a Tensor.
Close the current TensorArray.
The data type of this TensorArray.
Return the size of the TensorArray.