sequence_concat

paddle.static.nn. sequence_concat ( input, name=None ) [source]

Note

Only receives Tensor as input. If your input is Tensor, please use concat Op.(static.nn.** concat ).

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

input is a list of Tensor:
    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 Tensor:
    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 Tensor) – List of Tensor to be concatenated. The length of each Tensor 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 Tensor. The data type is same as input.

Return type

Tensor

Examples

>>> import paddle
>>> paddle.enable_static()

>>> x = paddle.static.data(name='x', shape=[-1, 10], dtype='float32', lod_level=1)
>>> y = paddle.static.data(name='y', shape=[-1, 10], dtype='float32', lod_level=1)
>>> out = paddle.static.nn.sequence_concat(input=[x, y])