Skip to contents

For each batch i, and class j, sparsemax activation function is defined as:

sparsemax(x)[i, j] = max(x[i, j] - (x[i, :]), 0).

Usage

activation_sparsemax(x, axis = -1L)

Arguments

x

Input tensor.

axis

int, axis along which the sparsemax operation is applied. (1-based)

Value

A tensor, output of sparsemax transformation. Has the same type and shape as x.