# sigmoid

Apply sigmoid activation

## Syntax

``Y = sigmoid(X)``

## Description

The sigmoid activation operation applies the sigmoid function to the input data.

This operation is equivalent to

`$f\left(x\right)=\frac{1}{1+{e}^{-x}}.$`

Note

This function applies the sigmoid operation to `dlarray` data. If you want to apply sigmoid within a `dlnetwork` object, use `sigmoidLayer`.

````Y = sigmoid(X)` computes the sigmoid activation of the input `X` by applying the sigmoid transfer function. All values in `Y` are between `0` and `1`.```

example

## Examples

collapse all

Use the `sigmoid` function to set all values in the input data to a value between `0` and `1`.

Create the input data as a single observation of random values with a height and width of seven and 32 channels.

```height = 7; width = 7; channels = 32; observations = 1; X = randn(height,width,channels,observations); X = dlarray(X,'SSCB');```

Compute the sigmoid activation.

`Y = sigmoid(X);`

All values in `Y` now range between `0` and `1`.

## Input Arguments

collapse all

Input data, specified as a formatted `dlarray`, an unformatted `dlarray`, or a numeric array.

Data Types: `single` | `double`

## Output Arguments

collapse all

Sigmoid activations, returned as a `dlarray`. All values in `Y` are between `0` and `1`. The output `Y` has the same underlying data type as the input `X`.

If the input data `X` is a formatted `dlarray`, `Y` has the same dimension format as `X`. If the input data is not a formatted `dlarray`, `Y` is an unformatted `dlarray` with the same dimension order as the input data.

## Version History

Introduced in R2019b