neuralmonkey.encoders.numpy_stateful_filler module¶
-
class
neuralmonkey.encoders.numpy_stateful_filler.
SpatialFiller
(name: str, input_shape: List[int], data_id: str, projection_dim: int = None, ff_hidden_dim: int = None, 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.SpatialStatefulWithOutput
Placeholder class for 3D numerical input.
This model part is used to feed 3D tensors (e.g., pre-trained convolutional maps image captioning). Optionally, the states are projected to given size.
-
__init__
(name: str, input_shape: List[int], data_id: str, projection_dim: int = None, ff_hidden_dim: int = None, reuse: neuralmonkey.model.model_part.ModelPart = None, save_checkpoint: str = None, load_checkpoint: str = None, initializers: List[Tuple[str, Callable]] = None) → None¶ Instantiate SpatialFiller.
Parameters: - name – Name of the model part.
- input_shape – Dimensionality of the input.
- data_id – Name of the data series with numpy objects.
- projection_dim – Optional, dimension of the states projection.
-
feed_dict
(dataset: neuralmonkey.dataset.Dataset, train: bool = False) → 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.
-
input_shapes
¶
-
input_types
¶
-
output
¶ Return the object output.
A 2D Tensor of shape (batch, state_size) which contains the resulting state of the object.
-
spatial_input
¶
-
spatial_mask
¶ Return mask for the spatial_states.
A 3D Tensor of shape (batch, width, height) of type float32 which masks the spatial states that they can be of different shapes. The mask should only contain ones or zeros.
-
spatial_states
¶ Return object states in space.
A 4D Tensor of shape (batch, width, height, state_size) which contains the states of the object in space (e.g. final layer of a convolution network processing an image.
-
-
class
neuralmonkey.encoders.numpy_stateful_filler.
StatefulFiller
(name: str, dimension: int, data_id: str, output_shape: int = None, 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.Stateful
Placeholder class for stateful input.
This model part is used to feed 1D tensors to the model. Optionally, it projects the states to given dimension.
-
__init__
(name: str, dimension: int, data_id: str, output_shape: int = None, reuse: neuralmonkey.model.model_part.ModelPart = None, save_checkpoint: str = None, load_checkpoint: str = None, initializers: List[Tuple[str, Callable]] = None) → None¶ Instantiate StatefulFiller.
Parameters: - name – Name of the model part.
- dimension – Dimensionality of the input.
- data_id – Series containing the numpy objects.
- output_shape – Dimension of optional state projection.
-
feed_dict
(dataset: neuralmonkey.dataset.Dataset, train: bool = False) → 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.
-
input_shapes
¶
-
input_types
¶
-
output
¶ Return the object output.
A 2D Tensor of shape (batch, state_size) which contains the resulting state of the object.
-
vector
¶
-