neuralmonkey.encoders.facebook_conv module

From the paper Convolutional Sequence to Sequence Learning.

http://arxiv.org/abs/1705.03122

class neuralmonkey.encoders.facebook_conv.SentenceEncoder(name: str, input_sequence: neuralmonkey.model.sequence.EmbeddedSequence, conv_features: int, encoder_layers: int, kernel_width: int = 5, dropout_keep_prob: float = 1.0, reuse: neuralmonkey.model.model_part.ModelPart = None, save_checkpoint: str = None, load_checkpoint: str = None, initializers: List[Tuple[str, Callable]] = None) → None

Bases: neuralmonkey.model.model_part.ModelPart, neuralmonkey.model.stateful.TemporalStatefulWithOutput

__init__(name: str, input_sequence: neuralmonkey.model.sequence.EmbeddedSequence, conv_features: int, encoder_layers: int, kernel_width: int = 5, dropout_keep_prob: float = 1.0, reuse: neuralmonkey.model.model_part.ModelPart = None, save_checkpoint: str = None, load_checkpoint: str = None, initializers: List[Tuple[str, Callable]] = None) → None

Construct a new parameterized object.

Parameters:
  • name – The name for the model part. Will be used in the variable and name scopes.
  • reuse – Optional parameterized part with which to share parameters.
  • save_checkpoint – Optional path to a checkpoint file which will store the parameters of this object.
  • load_checkpoint – Optional path to a checkpoint file from which to load initial variables for this object.
  • initializers – An InitializerSpecs instance with specification of the initializers.
order_embeddings
ordered_embedded_inputs
output

Return the object output.

A 2D Tensor of shape (batch, state_size) which contains the resulting state of the object.

temporal_mask

Return mask for the temporal_states.

A 2D Tensor of shape (batch, time) of type float32 which masks the temporal states so each sequence can have a different length. It should only contain ones or zeros.

temporal_states

Return object states in time.

A 3D Tensor of shape (batch, time, state_size) which contains the states of the object in time (e.g. hidden states of a recurrent encoder.