sigmoid - Apply sigmoid activation - MATLAB (original) (raw)

Main Content

Syntax

Description

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

This operation is equivalent to

[Y](#mw%5F12bcee23-017e-409f-b554-ec11b2e912d3) = sigmoid([X](#mw%5F004b0650-22e8-4155-a45a-9af5addd80a2%5Fsep%5Fmw%5F6f734774-5538-44ff-ad05-7e744f97893a)) computes the sigmoid activation of the input X by applying the sigmoid transfer function. All values in Y are between 0 and1.

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.

All values in Y now range between 0 and1.

Output Arguments

collapse all

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

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.

Extended Capabilities

expand all

The sigmoid function supports GPU array input with these usage notes and limitations:

For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced in R2019b