neuralmonkey.encoders.raw_rnn_encoder module¶
-
class
neuralmonkey.encoders.raw_rnn_encoder.
RawRNNEncoder
(name: str, data_id: str, input_size: int, rnn_layers: List[Union[Tuple[int], Tuple[int, str], Tuple[int, str, str]]], max_input_len: Union[int, NoneType] = None, dropout_keep_prob: float = 1.0, save_checkpoint: Union[str, NoneType] = None, load_checkpoint: Union[str, NoneType] = None, initializers: List[Tuple[str, Callable]] = None) → None¶ Bases:
neuralmonkey.model.model_part.ModelPart
,neuralmonkey.model.stateful.TemporalStatefulWithOutput
A raw RNN encoder that gets input as a tensor.
-
__init__
(name: str, data_id: str, input_size: int, rnn_layers: List[Union[Tuple[int], Tuple[int, str], Tuple[int, str, str]]], max_input_len: Union[int, NoneType] = None, dropout_keep_prob: float = 1.0, save_checkpoint: Union[str, NoneType] = None, load_checkpoint: Union[str, NoneType] = None, initializers: List[Tuple[str, Callable]] = None) → None¶ Create a new instance of the encoder.
Parameters: - data_id – Identifier of the data series fed to this encoder
- name – An unique identifier for this encoder
- rnn_layers – A list of tuples specifying the size and, optionally, the direction (‘forward’, ‘backward’ or ‘bidirectional’) and cell type (‘GRU’ or ‘LSTM’) of each RNN layer.
Keyword Arguments: dropout_keep_prob – The dropout keep probability (default 1.0)
-
feed_dict
(dataset: neuralmonkey.dataset.dataset.Dataset, train: bool = False) → Dict[tensorflow.python.framework.ops.Tensor, Any]¶ Populate the feed dictionary with the encoder inputs.
Parameters: - dataset – The dataset to use
- train – Boolean flag telling whether it is training time
-
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.
-