create_array

paddle.fluid.layers.control_flow. create_array ( dtype, initialized_list=None ) [source]

This OP creates an LOD_TENSOR_ARRAY. It is used as the input of api_fluid_layers_array_read and api_fluid_layers_array_write. Also it can be used with api_fluid_layers_While to create RNN network.

Parameters
  • dtype (str) – The data type of the elements in the lod_tensor_array. Support data type: float32, float64, int32, int64.

  • initialized_list (list) – Used to initialize as default value for created array. All values in initialized list should be a Tensor.

Returns

The empty lod_tensor_array. The data type of elements in Tensor is dtype.

Return type

Variable

Examples

import paddle.fluid as fluid
data = fluid.layers.create_array(dtype='float32') # Create a float32 LoDTensorArray.