Skip to content

Commit

Permalink
fix example codes
Browse files Browse the repository at this point in the history
  • Loading branch information
feifei-111 committed Dec 13, 2022
1 parent 1f43039 commit c4640f1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/paddle/fluid/layers/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,13 @@ def tensor_array_to_tensor(input, axis=1, name=None, use_stack=False):
Examples:
.. code-block:: python
import paddle
import paddle.fluid as fluid
import numpy as np
x0 = fluid.layers.assign(np.random.rand(2, 2).astype("float32"))
x1 = fluid.layers.assign(np.random.rand(2, 2).astype("float32"))
i = fluid.layers.fill_constant(shape=[1], dtype="int64", value=0)
array = fluid.layers.create_array(dtype='float32')
array = paddle.tensor.create_array(dtype='float32')
paddle.tensor.array_write(x0, i, array)
paddle.tensor.array_write(x1, i + 1, array)
output, output_index = fluid.layers.tensor_array_to_tensor(input=array)
Expand Down

0 comments on commit c4640f1

Please sign in to comment.