sequence_concat

api_attr

declarative programming (static graph)

paddle.fluid.layers.sequence_concat(input, name=None)[source]

Notes: The Op only receives LoDTensor as input. If your input is Tensor, please use concat Op.(fluid.layers. concat ).

This operator only supports LoDTensor as input. It concatenates the multiple LoDTensor from input by the LoD information, and outputs the concatenated LoDTensor.

input is a list of LoDTensor:
    input = [x1, x2]
where:
    x1.lod = [[0, 3, 5]]
    x1.data = [[1], [2], [3], [4], [5]]
    x1.shape = [5, 1]

    x2.lod = [[0, 2, 4]]
    x2.data = [[6], [7], [8], [9]]
    x2.shape = [4, 1]
and should satisfy: len(x1.lod[0]) == len(x2.lod[0])

output is LoDTensor:
    out.lod = [[0, 3+2, 5+4]]
    out.data = [[1], [2], [3], [6], [7], [4], [5], [8], [9]]
    out.shape = [9, 1]
Parameters
  • input (list of Variable) – List of LoDTensor to be concatenated. The length of each LoDTensor should be same. The data type can be float32, float64 or int64.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name .

Returns

Output the concatenated LoDTensor. The data type is same as input.

Return type

Variable

Examples

import paddle.fluid as fluid
x = fluid.data(name='x', shape=[-1, 10], dtype='float32', lod_level=1)
y = fluid.data(name='y', shape=[-1, 10], dtype='float32', lod_level=1)
out = fluid.layers.sequence_concat(input=[x, y])