Imported from https://github.com/qrfaction/keras-sparsemax