teras.activations.sparsemax

Contents

teras.activations.sparsemax#

teras.activations.sparsemax(logits, axis=-1)[source]#

Sparsemax activation function as proposed by T. Martins et al. in the paper, “From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification”

Reference(s):

https://arxiv.org/abs/1602.02068

Parameters:
  • logitsTensor, tensor of logits.

  • axis (int) – int, axis along which to apply the sparsemax activation. Defaults to -1.