Main Content

sigmoidLayer

Sigmoid layer

Since R2020b

Description

A sigmoid layer applies a sigmoid function to the input such that the output is bounded in the interval (0,1).

Tip

To use the sigmoid layer for binary or multilabel classification problems, set the loss function argument of the trainnet to "binary-crossentropy".

Creation

Description

layer = sigmoidLayer creates a sigmoid layer.

layer = sigmoidLayer('Name',Name) creates a sigmoid layer and sets the optional Name property using a name-value pair argument. For example, sigmoidLayer('Name','sig1') creates a sigmoid layer with the name 'sig1'. Enclose the property name in single quotes.

example

Properties

expand all

Layer name, specified as a character vector or string scalar. For Layer array input, the trainnet and dlnetwork functions automatically assign names to layers with the name "".

The SigmoidLayer object stores this property as a character vector.

Data Types: char | string

This property is read-only.

Number of inputs to the layer, returned as 1. This layer accepts a single input only.

Data Types: double

This property is read-only.

Input names, returned as {'in'}. This layer accepts a single input only.

Data Types: cell

This property is read-only.

Number of outputs from the layer, returned as 1. This layer has a single output only.

Data Types: double

This property is read-only.

Output names, returned as {'out'}. This layer has a single output only.

Data Types: cell

Examples

collapse all

Create a sigmoid layer with the name 'sig1'.

layer = sigmoidLayer('Name', 'sig1')
layer = 
  SigmoidLayer with properties:

    Name: 'sig1'

   Learnable Parameters
    No properties.

   State Parameters
    No properties.

Use properties method to see a list of all properties.

Algorithms

expand all

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

Version History

Introduced in R2020b