Learn R Programming

tfaddons (version 0.10.0)

activation_hardshrink: Hardshrink

Description

Hard shrink function.

Usage

activation_hardshrink(x, lower = -0.5, upper = 0.5)

Arguments

x

A `Tensor`. Must be one of the following types: `float16`, `float32`, `float64`.

lower

`float`, lower bound for setting values to zeros.

upper

`float`, upper bound for setting values to zeros. Returns: A `Tensor`. Has the same type as `x`.

Value

A `Tensor`. Has the same type as `x`.

Computes hard shrink function

`x if x < lower or x > upper else 0`.

Details

Computes hard shrink function: `x if x < lower or x > upper else 0`.

Examples

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

Run the code above in your browser using DataLab