SequenceGenerator

class opennmt.models.SequenceGenerator(*args, **kwargs)[source]

Base class for models generating sequences.

Inherits from: opennmt.models.Model

Extended by:

property decoder_inputter

The inputter used on the decoder side.

score(features, labels)[source]

Scores labels.

Parameters
  • features – A nested structure of features tf.Tensor.

  • labels – A nested structure of labels tf.Tensor.

Returns

The score results.

format_score(score, params=None)[source]

Formats the score result for file saving.

Parameters
  • score – The score result (same structure as the output of opennmt.models.Model.score()).

  • params – (optional) Dictionary of formatting parameters.