Addition Layer - Addition layer - Simulink (original) (raw)

Addition layer

Since R2024b

Libraries:
Deep Learning Toolbox / Deep Learning Layers / Combination Layers

Description

The Addition Layer block adds inputs from multiple neural network layers element-wise. Each nonscalar input to an Addition Layer block must have the same dimensions and must follow the data format that you specify with the Data format block parameter. The block expands scalar inputs to have the same dimensions as the other inputs.

The exportNetworkToSimulink function generates this block to represent an additionLayer object.

Limitations

Ports

Input

expand all

First input to add, provided as an array that follows the format that you specify with the Data format parameter.

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

Second input to add, provided as an array that follows the format that you specify with the Data format parameter.

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

_N_th input to add, provided as an array that follows the format that you specify with the Data format parameter. The block has a number of input ports equal to the value that you specify with the Number of inputs block parameter.

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

Output

expand all

The element-wise sum of the input data. The output data uses the format that you specify with the Data format block parameter.

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

Parameters

expand all

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

Main

Specify the number of inputs to the block. The block computes the sum of the inputs.

Programmatic Use

Block Parameter:NumInputs
Type: character vector
Values: '2' |'3' '4' '5'
Default: '2'

Data format for the input data. The options use the same notation as the fmt argument of thedlarray object, except layer blocks do not support the Batch (B) dimension and instead assume an observation number of1.

Programmatic Use

Block Parameter: DataFormat
Type: character vector
Values: 'SSC' | 'C' 'CT' 'SC' 'SSSC'
Default: 'SSC'

Data Types

Minimum value of the output range that the software checks.

The software uses the minimum value to perform:

Tips

Output minimum does not saturate or clip the actual output signal. Use the Saturation (Simulink) block instead.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: OutMin
Values: '[]' (default) | scalar in quotes

Maximum value of the output range that the software checks.

The software uses the maximum value to perform:

Tips

Output maximum does not saturate or clip the actual output signal. Use the Saturation (Simulink) block instead.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: OutMax
Values: '[]' (default) | scalar in quotes

Choose the data type for the output. The type can be inherited, specified directly, or expressed as a data type object such as Simulink.NumericType. When you select Inherit: Inherit via internal rule, Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: OutDataTypeStr
Values: 'Inherit: Inherit via internal rule' (default) | 'Inherit: Keep MSB' 'Inherit: Keep LSB' 'Inherit: Inherit via back propagation' 'Inherit: Same as first input' 'Inherit: Same as accumulator'

Select this parameter to prevent the fixed-point tools from overriding the data types you specify on this block. For more information, see Lock the Output Data Type Setting (Fixed-Point Designer).

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Block Parameter: LockScale
Type: character vector
Values: 'off' | 'on'
Default: 'off'

Specify the rounding mode for the output value of the block, generated by the final fixed-point cast operation. For the rounding mode for the other internal block operations, see Internal integer rounding mode. For more information, see Rounding Modes (Fixed-Point Designer).

Block parameters always round to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB® rounding function in the mask field.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: RndMeth
Values: 'Floor' (default) | 'Ceiling' 'Convergent' 'Nearest' 'Round' 'Simplest' 'Zero'

Specify whether integer overflows saturate or wrap for the output value of the block, generated by the final fixed-point cast operation. For the method of overflow action of the internal block operations, see Internal saturate on integer overflow.

For example, the maximum value that the signed 8-bit integer int8 can represent is 127. Any block operation result greater than the maximum value causes overflow of the 8-bit integer.

Tips

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: SaturateOnIntegerOverflow
Values: 'off' (default) | 'on'

Choose the data type for the accumulator. The type can be inherited, specified directly, or expressed as a data type object such as Simulink.NumericType. When you select Inherit: Inherit via internal rule, Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: AccumDataTypeStr
Values: 'Inherit: Inherit via internal rule' (default) | 'Inherit: Same as first input'

Specify the rounding mode for internal fixed-point computations except for the output operation. For the rounding mode of the output operation, see Output integer rounding mode. For more information, see Rounding Modes (Fixed-Point Designer).

Block parameters always round to the nearest representable value. To control the rounding of a block parameter, enter an expression using a MATLAB rounding function in the mask field.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: InternalRndMeth
Values: 'Floor' (default) | 'Ceiling' 'Convergent' 'Nearest' 'Round' 'Simplest' 'Zero'

Specify whether integer overflows saturate or wrap for the internal operations of the block. For the method of overflow action of the block output, see Output saturate on integer overflow.

For example, the maximum value that the signed 8-bit integer int8 can represent is 127. Any block operation result greater than the maximum value causes overflow of the 8-bit integer.

Tips

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: InternalSaturateOnIntegerOverflow
Values: 'off' (default) | 'on'

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 on the context of the block within the model.

Programmatic Use

To set the block parameter value programmatically, use the set_param (Simulink) function.

Parameter: SampleTime
Data Types: char
Values: '-1' (default) | scalar

Extended Capabilities

Version History

Introduced in R2024b

expand all

The Integer rounding mode and Saturate integer overflow parameters are now split into output and internal versions of the parameters. Output integer rounding mode and Output saturate on integer overflow control the behavior of the final cast operation of the output of the block. Internal integer rounding mode and Internal saturate on integer overflow control the internal block operations.

The Accumulator data type parameter is now namedAccumulator.