neuralmonkey.model.sequence_split module¶
Split temporal states such that the sequence is n-times longer.
-
class
neuralmonkey.model.sequence_split.
SequenceSplitter
(name: str, parent: neuralmonkey.model.stateful.TemporalStateful, factor: int, projection_size: int = None, projection_activation: Callable[[tensorflow.python.framework.ops.Tensor], tensorflow.python.framework.ops.Tensor] = None) → None¶ Bases:
neuralmonkey.model.stateful.TemporalStateful
,neuralmonkey.model.model_part.ModelPart
-
__init__
(name: str, parent: neuralmonkey.model.stateful.TemporalStateful, factor: int, projection_size: int = None, projection_activation: Callable[[tensorflow.python.framework.ops.Tensor], tensorflow.python.framework.ops.Tensor] = None) → None¶ Initialize SentenceSplitter.
Parameters: - parent – TemporalStateful whose states will be split.
- factor – Factor by which the states will be split - the resulting sequence will be longer by this factor.
- projection_size – If not None, specifies dimensionality of a projection before state splitting.
- projection_activation – Non-linearity function for the optional projection.
-
dependencies
¶ Return a list of attribute names regarded as dependents.
-
feed_dict
(dataset: neuralmonkey.dataset.Dataset, train: bool = True) → Dict[tensorflow.python.framework.ops.Tensor, Any]¶ Return a feed dictionary for the given feedable object.
Parameters: - dataset – A dataset instance from which to get the data.
- train – Boolean indicating whether the model runs in training mode.
Returns: A FeedDict dictionary 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.
-
-
neuralmonkey.model.sequence_split.
split_by_factor
(tensor_3d: tensorflow.python.framework.ops.Tensor, batch_size: tensorflow.python.framework.ops.Tensor, factor: int) → tensorflow.python.framework.ops.Tensor¶