activation_sparsemax: Sparsemax

View source: R/activations.R

activation_sparsemaxR Documentation

Sparsemax

Description

Sparsemax activation function [1].

Usage

activation_sparsemax(logits, axis = -1L)

Arguments

logits

Input tensor.

axis

Integer, axis along which the sparsemax operation is applied.

Details

For each batch 'i' and class 'j' we have $$sparsemax[i, j] = max(logits[i, j] - tau(logits[i, :]), 0)$$ [1]: https://arxiv.org/abs/1602.02068

Value

Tensor, output of sparsemax transformation. Has the same type and shape as 'logits'. Raises: ValueError: In case 'dim(logits) == 1'.

Raises

ValueError: In case 'dim(logits) == 1'.


henry090/tfaddons documentation built on April 7, 2022, 11:27 p.m.