create_sequence_records

opennmt.inputters.create_sequence_records(vectors, path, compression=None)[source]

Creates a TFRecord file of sequence vectors.

Parameters
  • vectors – An iterable of 2D Numpy float arrays of shape \([T, D]\).

  • path – The output TFRecord file.

  • compression – Optional compression type, can be “GZIP”.

Returns

Path to the TFRecord file. In most cases this is the same as path but if GZIP compression is enabled, the “.gz” extension is added if not already present.

Raises

ValueError – if compression is invalid.