chainer.functions.pad_sequence

chainer.functions.pad_sequence(xs, length=None, padding=0)[source]

Pad given arrays to make a matrix.

Parameters:
  • xs (list of ~chainer.Variable) – Variables you want to concatenate.
  • length (None or int) – Size of the first dimension of a padded array. If it is None, the longest size of the first dimension of xs is used.
  • padding (int or float) – Value to fill.
Returns:

A padded matrix. Its shape is (n, length, ...), where n == len(xs).

Return type:

Variable