def log_mask_zero(a):
 a = np.asarray(a)
 with np.errstate(divide='ignore'):
  a_log = np.log(a)
  a_log[(a <= 0)] = 0.0
  return a_log

def log_mask_zero ( a ) : a = np . asarray ( a ) with np . errstate ( divide = 'ignore' ) : a_log = np . log ( a ) a_log [ ( a <= 0 ) ] = 0.0 return a_log
computes the log of input probabilities masking divide by zero in log .