Learn R Programming

tfaddons (version 0.10.0)

layer_sparsemax: Sparsemax activation function

Description

Sparsemax activation function

Usage

layer_sparsemax(object, axis = -1, ...)

Arguments

object

Model or layer object

axis

Integer, axis along which the sparsemax normalization is applied.

...

additional parameters to pass

Value

A tensor

Details

The output shape is the same as the input shape. https://arxiv.org/abs/1602.02068

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
model = keras_model_sequential() %>%
  layer_conv_2d(filters = 10, kernel_size = c(3,3),input_shape = c(28,28,1),
                activation = activation_gelu) %>%
  layer_sparsemax()
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab