Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub

Types used in Synet Framework. More...

Data Structures

struct  SimdConvolutionParameters
 

Typedefs

typedef struct SimdConvolutionParameters SimdConvolutionParameters
 

Enumerations

enum  SimdConvolutionActivationType {
  SimdConvolutionActivationIdentity = 0 ,
  SimdConvolutionActivationRelu ,
  SimdConvolutionActivationLeakyRelu ,
  SimdConvolutionActivationRestrictRange ,
  SimdConvolutionActivationPrelu ,
  SimdConvolutionActivationElu ,
  SimdConvolutionActivationHswish ,
  SimdConvolutionActivationMish ,
  SimdConvolutionActivationHardSigmoid ,
  SimdConvolutionActivationSwish ,
  SimdConvolutionActivationGelu
}
 
enum  SimdSynetCompatibilityType {
  SimdSynetCompatibilityDefault = 0 ,
  SimdSynetCompatibilityFmaUse = 0 ,
  SimdSynetCompatibilityFmaNoTail = 1 ,
  SimdSynetCompatibilityFmaAvoid = 2 ,
  SimdSynetCompatibilityFmaMask = 3 ,
  SimdSynetCompatibility8iPrecise = 0 ,
  SimdSynetCompatibility8iOverflow = 4 ,
  SimdSynetCompatibility8iNarrowed = 8 ,
  SimdSynetCompatibility8iMask = 12 ,
  SimdSynetCompatibility16bfAvoid = 0 ,
  SimdSynetCompatibility16bfHard = 16 ,
  SimdSynetCompatibility16bfSoft = 32 ,
  SimdSynetCompatibility16bfMask = 48 ,
  SimdSynetCompatibility16fpAvoid = 0 ,
  SimdSynetCompatibility16fpHard = 64 ,
  SimdSynetCompatibility16fpSoft = 128 ,
  SimdSynetCompatibility16fpMask = 192
}
 
enum  SimdSynetEltwiseOperationType {
  SimdSynetEltwiseOperationProduct ,
  SimdSynetEltwiseOperationSum ,
  SimdSynetEltwiseOperationMax ,
  SimdSynetEltwiseOperationMin
}
 
enum  SimdSynetUnaryOperation32fType {
  SimdSynetUnaryOperation32fAbs ,
  SimdSynetUnaryOperation32fCeil ,
  SimdSynetUnaryOperation32fCos ,
  SimdSynetUnaryOperation32fErf ,
  SimdSynetUnaryOperation32fExp ,
  SimdSynetUnaryOperation32fFloor ,
  SimdSynetUnaryOperation32fLog ,
  SimdSynetUnaryOperation32fNeg ,
  SimdSynetUnaryOperation32fNot ,
  SimdSynetUnaryOperation32fRcp ,
  SimdSynetUnaryOperation32fRound ,
  SimdSynetUnaryOperation32fRsqrt ,
  SimdSynetUnaryOperation32fSign ,
  SimdSynetUnaryOperation32fSin ,
  SimdSynetUnaryOperation32fSqrt ,
  SimdSynetUnaryOperation32fTanh ,
  SimdSynetUnaryOperation32fZero
}
 
enum  SimdTensorFormatType {
  SimdTensorFormatUnknown = -1 ,
  SimdTensorFormatNchw ,
  SimdTensorFormatNhwc
}
 
enum  SimdTensorDataType {
  SimdTensorDataUnknown = -1 ,
  SimdTensorData32f ,
  SimdTensorData32i ,
  SimdTensorData8i ,
  SimdTensorData8u ,
  SimdTensorData64i ,
  SimdTensorData64u ,
  SimdTensorDataBool ,
  SimdTensorData16b ,
  SimdTensorData16f
}
 

Detailed Description

Types used in Synet Framework.

Typedef Documentation

◆ SimdConvolutionParameters

Describes convolution and deconvolution geometry, tensor types and activation.

This structure is passed to convolution, deconvolution and merged-convolution initialization functions. For convolution, destination spatial size must satisfy:

dstH = (srcH + padY + padH - (dilationY*(kernelY - 1) + 1)) / strideY + 1
dstW = (srcW + padX + padW - (dilationX*(kernelX - 1) + 1)) / strideX + 1

For deconvolution, destination spatial size must satisfy:

dstH = strideY*(srcH - 1) + dilationY*(kernelY - 1) + 1 - padY - padH
dstW = strideX*(srcW - 1) + dilationX*(kernelX - 1) + 1 - padX - padW

The weight tensor contains kernelY*kernelX*srcC*dstC/group elements. A depthwise convolution is represented by group == srcC == dstC.

Enumeration Type Documentation

◆ SimdConvolutionActivationType

Describes activation functions used by Synet convolution, deconvolution, inner product, merged convolution, quantized convolution and quantized add APIs.

Activations are applied after bias/normalization/addition as documented by the corresponding function. Parameters are passed through the params or actParams arguments of those functions. A NULL parameter pointer is valid only for activations that do not use parameters.

Enumerator
SimdConvolutionActivationIdentity 

Identity activation: no transformation is applied.

dst[i] = src[i];
SimdConvolutionActivationRelu 

ReLU activation function. It does not use parameters.

dst[i] = Max(0, src[i]);
SimdConvolutionActivationLeakyRelu 

Leaky ReLU activation function. It has one parameter: negative slope (params[0]).

dst[i] = src[i] > 0 ? src[i] : slope*src[i];
SimdConvolutionActivationRestrictRange 

RestrictRange activation function. It clamps the value to the interval [lower, upper], where lower = params[0] and upper = params[1].

dst[i] = Min(Max(lower, src[i]), upper);
SimdConvolutionActivationPrelu 

PReLU activation function. It uses one negative slope per destination channel. For a convolution output with dstC channels and spatial size n = dstH*dstW, params[c] is used for channel c.

dst[c*n + j] = src[c*n + j] > 0 ? src[c*n + j] : params[c]*src[c*n + j];
SimdConvolutionActivationElu 

ELU activation function. It has one parameter: alpha (params[0]).

dst[i] = src[i] >= 0 ? src[i] : alpha*(Exp(src[i]) - 1);
SimdConvolutionActivationHswish 

H-Swish (https://arxiv.org/pdf/1905.02244.pdf) activation function. It has two parameters: shift (params[0]) and scale (params[1]). Typical values are shift = 3 and scale = 1/6.

dst[i] = Max(Min(src[i], shift) + shift, 0)*scale*src[i];
SimdConvolutionActivationMish 

Mish (https://arxiv.org/abs/1908.08681) activation function. It has one parameter: threshold (params[0]). Values greater than threshold are returned unchanged.

dst[i] = src[i] > threshold ? src[i] : src[i]*(1 - 2/(Square(Exp(src[i]) + 1) + 1));
SimdConvolutionActivationHardSigmoid 

HardSigmoid (https://pytorch.org/docs/stable/generated/torch.nn.Hardsigmoid.html) activation function. It has two parameters: scale (params[0]) and shift (params[1]).

dst[i] = Max(0, Min(src[i] * scale + shift, 1));
SimdConvolutionActivationSwish 

Swish (https://en.wikipedia.org/wiki/Swish_function) activation function. It has one parameter: slope (params[0]).

dst[i] = src[i]/(1 + Exp(-slope*src[i]));
SimdConvolutionActivationGelu 

GELU (https://en.wikipedia.org/wiki/Activation_function) activation function. It does not use parameters.

dst[i] = src[i] * (1 + erf(src[i]/sqrt(2))) / 2;

◆ SimdSynetCompatibilityType

Describes Synet calculation compatibility flags.

Values are grouped into independent bit fields and can be combined with bitwise OR. The FMA field controls use of fused multiply-add instructions, the 8-bit integer field controls quantized multiplication/range policy, and the BF16/FP16 fields request use of reduced-precision formats. Masks are provided to extract each field.

This type is used in functions such as SimdSynetAdd8i, SimdSynetScaleLayerForward, SimdSynetConvert32fTo8u, SimdSynetConvert8uTo32f, SimdSynetInnerProduct8i, SimdSynetScale8iInit, SimdSynetConvolution16bInit, SimdSynetConvolution8iInit, SimdSynetMergedConvolution16bInit and SimdSynetMergedConvolution8iInit.

Enumerator
SimdSynetCompatibilityDefault 

Default compatibility value: use the fastest supported policy for each field.

SimdSynetCompatibilityFmaUse 

Allow FMA instructions where implementations support them.

SimdSynetCompatibilityFmaNoTail 

Avoid FMA instructions at row tails for stricter reproducibility.

SimdSynetCompatibilityFmaAvoid 

Avoid FMA instructions completely.

SimdSynetCompatibilityFmaMask 

Mask used to extract FMA policy bits.

SimdSynetCompatibility8iPrecise 

Use precise 8-bit integer multiplication (VNNI or 16-bit emulation).

SimdSynetCompatibility8iOverflow 

Allow 16-bit intermediate overflow in 8-bit integer multiplication paths.

SimdSynetCompatibility8iNarrowed 

Use narrowed input ranges (signed [-90..90], unsigned [0..180]) to avoid 16-bit overflow.

SimdSynetCompatibility8iMask 

Mask used to extract 8-bit integer multiplication policy bits.

SimdSynetCompatibility16bfAvoid 

Do not request BFloat16 (Brain Floating Point) internal computation.

SimdSynetCompatibility16bfHard 

Use BFloat16 internal computation only when hardware support exists.

SimdSynetCompatibility16bfSoft 

Use BFloat16 internal computation with software emulation when hardware support is absent.

SimdSynetCompatibility16bfMask 

Mask used to extract BFloat16 policy bits.

SimdSynetCompatibility16fpAvoid 

Do not request 16-bit floating point (Half Precision) internal computation.

SimdSynetCompatibility16fpHard 

Use 16-bit floating point internal computation only when hardware support exists.

SimdSynetCompatibility16fpSoft 

Use 16-bit floating point internal computation with software emulation when hardware support is absent.

SimdSynetCompatibility16fpMask 

Mask used to extract 16-bit floating point policy bits.

◆ SimdSynetEltwiseOperationType

Describes operation type used by SimdSynetEltwiseLayerForward.

The function combines at least two equally sized FP32 arrays element by element. The weight array is used only by SimdSynetEltwiseOperationSum.

Enumerator
SimdSynetEltwiseOperationProduct 

Product of corresponding elements from all input arrays.

SimdSynetEltwiseOperationSum 

Weighted sum of corresponding elements from all input arrays.

SimdSynetEltwiseOperationMax 

Maximum of corresponding elements from all input arrays.

SimdSynetEltwiseOperationMin 

Minimum of corresponding elements from all input arrays.

◆ SimdSynetUnaryOperation32fType

Describes unary operation type used by SimdSynetUnaryOperation32f.

Each operation is applied independently to every 32-bit floating point element of the input array.

Enumerator
SimdSynetUnaryOperation32fAbs 

Absolute value: dst = Abs(src).

SimdSynetUnaryOperation32fCeil 

Ceiling: dst = Ceil(src).

SimdSynetUnaryOperation32fCos 

Cosine: dst = Cos(src).

SimdSynetUnaryOperation32fErf 

Error function: dst = Erf(src).

SimdSynetUnaryOperation32fExp 

Exponent: dst = Exp(src).

SimdSynetUnaryOperation32fFloor 

Floor: dst = Floor(src).

SimdSynetUnaryOperation32fLog 

Natural logarithm: dst = Log(src).

SimdSynetUnaryOperation32fNeg 

Negation: dst = -src.

SimdSynetUnaryOperation32fNot 

Bitwise NOT applied to the IEEE-754 representation of the source value.

SimdSynetUnaryOperation32fRcp 

Reciprocal: dst = 1/src.

SimdSynetUnaryOperation32fRound 

Round to nearest integer value in FP32 representation.

SimdSynetUnaryOperation32fRsqrt 

Reciprocal square root: dst = 1/Sqrt(src).

SimdSynetUnaryOperation32fSign 

Sign function: -1 for negative values, 0 for zero and 1 for positive values.

SimdSynetUnaryOperation32fSin 

Sine: dst = Sin(src).

SimdSynetUnaryOperation32fSqrt 

Square root: dst = Sqrt(src).

SimdSynetUnaryOperation32fTanh 

Hyperbolic tangent: dst = Tanh(src).

SimdSynetUnaryOperation32fZero 

Zeroing: dst = 0.

◆ SimdTensorFormatType

Describes tensor memory layout used by Synet functions.

Most functions use 4D tensors with dimensions batch (N), channels (C), height (H) and width (W). Some shape-based helper functions accept SimdTensorFormatUnknown when layout is irrelevant.

Enumerator
SimdTensorFormatUnknown 

Unknown or layout-independent tensor format.

SimdTensorFormatNchw 

NCHW layout: offset = ((n*C + c)*H + h)*W + w.

SimdTensorFormatNhwc 

NHWC layout: offset = ((n*H + h)*W + w)*C + c.

◆ SimdTensorDataType

Describes tensor element data type used by Synet functions.

The value defines interpretation and size of each tensor element. Reduced precision values SimdTensorData16b and SimdTensorData16f are stored in 16-bit containers.

Enumerator
SimdTensorDataUnknown 

Unknown tensor data type.

SimdTensorData32f 

32-bit floating point (single precision).

SimdTensorData32i 

32-bit signed integer.

SimdTensorData8i 

8-bit signed integer.

SimdTensorData8u 

8-bit unsigned integer.

SimdTensorData64i 

64-bit signed integer.

SimdTensorData64u 

64-bit unsigned integer.

SimdTensorDataBool 

Boolean value stored in one byte.

SimdTensorData16b 

16-bit BFloat16 (Brain Floating Point) stored in uint16_t.

SimdTensorData16f 

16-bit floating point (Half Precision) stored in uint16_t/int16_t.