nn.hard_sigmoid

   fn hard_sigmoid(tensor: @Tensor<T>, alpha: @T, beta: @T) -> Tensor<T>;

Applies the HardSigmoid function to an n-dimensional input tensor.

HardSigmoid(xi)=max(0,min(alphax+beta,1))\text{HardSigmoid}(x_i) = \text{max}(0, \text{min}(alpha * x + beta, 1))

Args

  • tensor(@Tensor<T>) - The input tensor.

  • alpha(@T) - value of alpha.

  • beta(@T) - value of beta.

Returns

A Tensor of fixed point numbers with the same shape than the input Tensor.

Type Constraints

Constrain input and output types to fixed point tensors.

Examples

Last updated

Was this helpful?