neuralmonkey.trainers.generic_trainer module

class neuralmonkey.trainers.generic_trainer.GenericTrainer(objectives: List[neuralmonkey.trainers.generic_trainer.Objective], l1_weight: float = 0.0, l2_weight: float = 0.0, clip_norm: float = None, optimizer: tensorflow.python.training.optimizer.Optimizer = None, var_scopes: List[str] = None, var_collection: str = None) → None

Bases: neuralmonkey.runners.base_runner.GraphExecutor

class Executable(executor: neuralmonkey.trainers.generic_trainer.GenericTrainer, compute_losses: bool, summaries: bool, num_sessions: int) → None

Bases: neuralmonkey.runners.base_runner.Executable

__init__(executor: neuralmonkey.trainers.generic_trainer.GenericTrainer, compute_losses: bool, summaries: bool, num_sessions: int) → None

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

collect_results(results: List[Dict]) → None
next_to_execute() → Tuple[Union[Dict, List], List[Dict[tensorflow.python.framework.ops.Tensor, Union[int, float, numpy.ndarray]]]]

Get the tensors and additional feed dicts for execution.

__init__(objectives: List[neuralmonkey.trainers.generic_trainer.Objective], l1_weight: float = 0.0, l2_weight: float = 0.0, clip_norm: float = None, optimizer: tensorflow.python.training.optimizer.Optimizer = None, var_scopes: List[str] = None, var_collection: str = None) → None

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

static default_optimizer()
differentiable_loss_sum

Compute the differentiable loss (including regularization).

fetches
gradients
objective_values

Compute unweighted losses for fetching.

raw_gradients

Compute the gradients.

regularization_losses

Compute the regularization losses, e.g. L1 and L2.

summaries
train_op

Construct the training op.

var_list
class neuralmonkey.trainers.generic_trainer.Objective

Bases: neuralmonkey.trainers.generic_trainer.Objective

The training objective.

name

The name for the objective. Used in TensorBoard.

decoder

The decoder which generates the value to optimize.

loss

The loss tensor fetched by the trainer.

gradients

Manually specified gradients. Useful for reinforcement learning.

weight

The weight of this objective. The loss will be multiplied by this so the gradients can be controled in case of multiple objectives.