```输入：
包含4个Tensor的LoDTensorArray，前3个shape为[1]，最后一个shape为[1,2]:
input = ([0.6], [0.1], [0.3], [0.4, 0.2])
并且：
i = [3]

output = [0.4, 0.2]
```

## 参数¶

• array (Variable) - 输入的数组LoDTensorArray

• i (Variable) - shape为[1]的1-D Tensor，表示从 `array` 中读取数据的位置，数据类型为int64

## 返回¶

`array` 中指定位置读取的LoDTensor或Tensor

Variable

## 代码示例¶

```#先创建一个LoDTensorArray，再在指定位置写入Tensor，然后从该位置读取Tensor
arr = fluid.layers.create_array(dtype='float32')
tmp = fluid.layers.fill_constant(shape=[3, 2], dtype='int64', value=5)
i = fluid.layers.fill_constant(shape=[1], dtype='int64', value=10)
#tmp是shape为[3,2]的Tensor，将其写入空数组arr的下标10的位置，则arr的长度变为11
arr = fluid.layers.array_write(tmp, i, array=arr)
#读取arr的下标10的位置的数据

#可以通过executor打印出该数据
input = fluid.layers.Print(item, message="The LoDTensor of the i-th position:")
main_program = fluid.default_main_program()
exe = fluid.Executor(fluid.CPUPlace())
exe.run(main_program)
```

```# First we're going to create a LoDTensorArray, then we're going to write the Tensor into
# the specified position, and finally we're going to read the Tensor at that position.
arr = fluid.layers.create_array(dtype='float32')
tmp = fluid.layers.fill_constant(shape=[3, 2], dtype='int64', value=5)
i = fluid.layers.fill_constant(shape=[1], dtype='int64', value=10)
# tmp is the Tensor with shape [3,2], and if we write it into the position with subscript 10
# of the empty-array: arr, then the length of arr becomes 11.
arr = fluid.layers.array_write(tmp, i, array=arr)
# Read the data of the position with subscript 10.

# You can print out the data via executor.
input = fluid.layers.Print(item, message="The LoDTensor of the i-th position:")
main_program = fluid.default_main_program()
exe = fluid.Executor(fluid.CPUPlace())
exe.run(main_program)

# The printed result is:

# 1569588169  The LoDTensor of the i-th position: The place is:CPUPlace