neuralmonkey.runners.tensor_runner module¶
-
class
neuralmonkey.runners.tensor_runner.RepresentationRunner(output_series: str, encoder: neuralmonkey.model.model_part.GenericModelPart, attribute: str = 'output', select_session: int = None) → None¶ Bases:
neuralmonkey.runners.tensor_runner.TensorRunnerRunner printing out representation from an encoder.
Use this runner to get input / other data representation out from one of Neural Monkey encoders.
-
__init__(output_series: str, encoder: neuralmonkey.model.model_part.GenericModelPart, attribute: str = 'output', select_session: int = None) → None¶ Initialize the representation runner.
Parameters: - output_series – Name of the output series with vectors.
- encoder – The encoder to use. This can be any
GenericModelPartobject. - attribute – The name of the encoder attribute that contains the data.
- used_session – Id of the TensorFlow session used in case of model ensembles.
-
-
class
neuralmonkey.runners.tensor_runner.TensorRunner(output_series: str, modelparts: List[neuralmonkey.model.model_part.GenericModelPart], tensors: List[str], batch_dims: List[int], tensors_by_name: List[str], batch_dims_by_name: List[int], select_session: int = None, single_tensor: bool = False) → None¶ Bases:
neuralmonkey.runners.base_runner.BaseRunnerRunner class for printing tensors from a model.
Use this runner if you want to retrieve a specific tensor from the model using a given dataset. The runner generates an output data series which will contain the tensors in a dictionary of numpy arrays.
-
class
Executable(executor: Executor, compute_losses: bool, summaries: bool, num_sessions: int) → None¶ Bases:
neuralmonkey.runners.base_runner.Executable-
collect_results(results: List[Dict]) → None¶
-
-
__init__(output_series: str, modelparts: List[neuralmonkey.model.model_part.GenericModelPart], tensors: List[str], batch_dims: List[int], tensors_by_name: List[str], batch_dims_by_name: List[int], select_session: int = None, single_tensor: bool = False) → None¶ Construct a new
TensorRunnerobject.Note that at this time, one must specify the toplevel objects so that it is ensured that the graph is built. The reason for this behavior is that the graph is constructed lazily and therefore if the tensors to store are provided by indirect reference (name), the system does not know early enough that it needs to create them.
Parameters: - output_series – The name of the generated output data series.
- modelparts – A list of
GenericModelPartobjects that hold the tensors that will be retrieved. - tensors – A list of names of tensors that should be retrieved.
- batch_dims_by_ref – A list of integers that correspond to the batch dimension in each wanted tensor.
- tensors_by_name – A list of tensor names to fetch. If a tensor is not in the graph, a warning is generated and the tensor is ignored.
- batch_dims_by_name – A list of integers that correspond to the batch dimension in each wanted tensor specified by name.
- select_session – An optional integer specifying the session to use in case of ensembling. When not used, tensors from all sessions are stored. In case of a single session, this option has no effect.
- single_tensor – If True, it is assumed that only one tensor is to be fetched, and the execution result will consist of this tensor only. If False, the result will be a dict mapping tensor names to NumPy arrays.
-
fetches¶
-
loss_names¶
-
class