MarkovChainModel.forward

MarkovChainModel.forward(sequences: torch.Tensor) torch.Tensor[source]
MarkovChainModel.forward(sequences: torch.nn.utils.rnn.PackedSequence) torch.Tensor

Computes the log-probability of observing each of the provided sequences.

Parameters

sequences -- Tensor of shape [num_sequences, sequence_length] or a packed sequence. Packed sequences should be used whenever the sequence lengths differ. All sequences must contain state indices of dtype long.

Return type

Tensor

Returns

A tensor of shape [sequence_length], returning the log-probability of each

sequence.