Nabu-asr
Functions
loss_functions.py File Reference

contains functions to compute the training loss More...

Functions

def nabu.neuralnetworks.trainers.loss_functions.factory (loss_function)
 factory method for the loss function More...
 
def nabu.neuralnetworks.trainers.loss_functions.marigin_loss (targets, logits, logit_seq_length, target_seq_length)
 marigin loss More...
 
def nabu.neuralnetworks.trainers.loss_functions.cross_entropy (targets, logits, seq_length)
 compute the cross entropy for all sequences in the batch More...
 
def nabu.neuralnetworks.trainers.loss_functions.sigmoid_cross_entropy (targets, logits, seq_length)
 compute the sigmnoid cross entropy for all sequences in the batch More...
 
def nabu.neuralnetworks.trainers.loss_functions.sum_cross_entropy (targets, logits, logit_seq_length, target_seq_length)
 cross entropy summed over timesteps
 
def nabu.neuralnetworks.trainers.loss_functions.average_cross_entropy (targets, logits, logit_seq_length, target_seq_length)
 cross entropy averaged over timesteps
 
def nabu.neuralnetworks.trainers.loss_functions.average_sigmoid_cross_entropy (targets, logits, logit_seq_length, target_seq_length)
 sigmoid cross entropy averaged over timesteps
 
def nabu.neuralnetworks.trainers.loss_functions.CTC (targets, logits, logit_seq_length, target_seq_length)
 CTC loss. More...
 

Detailed Description

contains functions to compute the training loss

Function Documentation

§ cross_entropy()

def nabu.neuralnetworks.trainers.loss_functions.cross_entropy (   targets,
  logits,
  seq_length 
)

compute the cross entropy for all sequences in the batch

Parameters
targetsa dictionary of [batch_size x time x ...] tensor containing the targets
logitsa dictionary of [batch_size x time x ...] tensor containing the logits
seq_lengtha dictionary of [batch_size] vectors containing the sequence lengths
Returns
a dictionarie of vectors of [batch_size] containing the cross_entropy

§ CTC()

def nabu.neuralnetworks.trainers.loss_functions.CTC (   targets,
  logits,
  logit_seq_length,
  target_seq_length 
)

CTC loss.

Parameters
targetsa dictionary of [batch_size x time x ...] tensor containing the targets
logitsa dictionary of [batch_size x time x ...] tensor containing the logits
logit_seq_lengtha dictionary of [batch_size] vectors containing the logit sequence lengths
target_seq_lengtha dictionary of [batch_size] vectors containing the target sequence lengths
Returns
a scalar value containing the loss

§ factory()

def nabu.neuralnetworks.trainers.loss_functions.factory (   loss_function)

factory method for the loss function

Parameters
loss_functionthe required loss function
Returns
a callable loss function

§ marigin_loss()

def nabu.neuralnetworks.trainers.loss_functions.marigin_loss (   targets,
  logits,
  logit_seq_length,
  target_seq_length 
)

marigin loss

Parameters
targetsa dictionary of [batch_size x time x ...] tensor containing the targets
logitsa dictionary of [batch_size x time x ...] tensor containing the logits
logit_seq_lengtha dictionary of [batch_size] vectors containing the logit sequence lengths
target_seq_lengtha dictionary of [batch_size] vectors containing the target sequence lengths
Returns
a scalar value containing the loss

§ sigmoid_cross_entropy()

def nabu.neuralnetworks.trainers.loss_functions.sigmoid_cross_entropy (   targets,
  logits,
  seq_length 
)

compute the sigmnoid cross entropy for all sequences in the batch

Parameters
targetsa dictionary of [batch_size x time x ...] tensor containing the targets
logitsa dictionary of [batch_size x time x ...] tensor containing the logits
seq_lengtha dictionary of [batch_size] vectors containing the sequence lengths
Returns
a dictionary of vectors of [batch_size] containing the cross_entropy