Main Content

Tanh Layer

Hyperbolic tangent (tanh) layer

Since R2024a

  • Tanh Layer block

Libraries:
Deep Learning Toolbox / Deep Learning Layers / Activation Layers

Description

The Tanh Layer block applies the tanh function to layer inputs.

The exportNetworkToSimulink function generates this block to represent a tanhLayer object. Because it applies an element-wise operation, this block supports input data of any format and outputs data that has the same dimensions and format as the input.

Ports

Input

expand all

The matrix on which to perform the hyperbolic tangent operation.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Output

expand all

The result of performing the hyperbolic tangent operation on the input matrix.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fixed point

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Data Types

Specify the type of approximation for computing the output.

Approximation MethodData Types SupportedWhen to Use This Method
None (default)

Floating point

You are processing only floating point data.

CORDIC

Floating point (double and single) and fixed point with a Bias value of 0 and a Slope value of a power of 2

You are processing fixed point data and want to deploy to FPGA hardware.

Lookup

Floating point and fixed point

You are processing fixed point data and want to generate C/C++ code.

For more information about the CORDIC approximation method, see cordictanh (Fixed-Point Designer).

Programmatic Use

Block Parameter: ApproximationMethod
Type: character vector
Values: 'none' | 'CORDIC' | 'Lookup'
Default: 'none'

Execution

Specify the discrete interval between sample time hits or specify another type of sample time, such as continuous (0) or inherited (-1). For more options, see Types of Sample Time (Simulink).

By default, the block inherits its sample time based upon the context of the block within the model.

Programmatic Use

Block Parameter: SampleTime
Type: character vector
Values: scalar
Default: '-1'

Extended Capabilities

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

Version History

Introduced in R2024a