def softmax(mat, target = None):
  """
  Apply softmax activation to each column of mat.
  """
  if not target:
    target = mat

  err_code = _eigenmat.apply_softmax(mat.p_mat, target.p_mat)
  if err_code:
    raise generate_exception(err_code)
  return target

  Apply softmax activation to each column of mat.
  
eigenmat/eigenmat.py