def _beta_loss_to_float(beta_loss):
 allowed_beta_loss = {'frobenius': 2, 'kullback-leibler': 1, 'itakura-saito': 0}
 if (isinstance(beta_loss, str) and (beta_loss in allowed_beta_loss)):
  beta_loss = allowed_beta_loss[beta_loss]
 if (not isinstance(beta_loss, numbers.Number)):
  raise ValueError(('Invalid beta_loss parameter: got %r instead of one of %r, or a float.' % (beta_loss, allowed_beta_loss.keys())))
 return beta_loss

def _beta_loss_to_float ( beta_loss ) : allowed_beta_loss = { 'frobenius' : 2 , 'kullback-leibler' : 1 , 'itakura-saito' : 0 } if ( isinstance ( beta_loss , str ) and ( beta_loss in allowed_beta_loss ) ) : beta_loss = allowed_beta_loss [ beta_loss ] if ( not isinstance ( beta_loss , numbers . Number ) ) : raise ValueError ( ( 'Invalid beta_loss parameter: got %r instead of one of %r, or a float.' % ( beta_loss , allowed_beta_loss . keys ( ) ) ) ) return beta_loss
convert string beta_loss to float .