DecoderEvent

The DecoderEvent is an instance of the pytorch nn.Module class. This part of the neural network takes the encoded inputs from the Encoder and attention_vector from the DecoderAttention and predicts the next event in the sequence.

class context_builder.decoders.DecoderEvent(*args: Any, **kwargs: Any)[source]
DecoderEvent.__init__(input_size, output_size, dropout=0.1)[source]

Forward

The forward() function takes the attention_vector and encoded inputs and predicts the next event in the sequence. This method is also called from the __call__ method, i.e. when the object is called directly.

DecoderEvent.forward(X, attention)[source]

Decode X with given attention.

Parameters:
  • X (torch.Tensor of shape=(n_samples, context_size, hidden_size)) – Input samples on which to apply attention.

  • attention (torch.Tensor of shape=(n_samples, context_size)) – Attention to use for decoding step

Returns:

output – Decoded output

Return type:

torch.Tensor of shape=(n_samples, output_size)