neuralmonkey.model.feedable module

class neuralmonkey.model.feedable.Feedable → None

Bases: object

Base class for feedable model parts.

In TensorFlow, data is provided to the model using placeholders. Neural Monkey abstraction objects, such as encoders or decoders, can be members of this class in order to be able to receive data inputs from the framework.

All feedable objects have a feed_dict method, which gets the current dataset and returns a FeedDict dictionary which assigns values to symbolic placeholders.

Additionally, each Feedable object has two placeholders which are fed automatically in this super class - batch_size and train_mode.

__init__() → None

Initialize self. See help(type(self)) for accurate signature.

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.