Compute Library
 22.11
arm_compute Namespace Reference

Copyright (c) 2017-2022 Arm Limited. More...

Namespaces

 assembly_utils
 
 cl_direct_conv
 
 cl_gemm
 
 cl_tuner
 
 cpu
 
 cpuinfo
 
 detail
 
 experimental
 
 gpu
 
 graph
 
 graph_utils
 
 helpers
 
 io
 
 kernels
 
 logging
 
 misc
 
 mlgo
 
 opencl
 Interface to convert the 2D Fully Connected weights from NCHW to NHWC or vice versa.
 
 quantization
 
 scale_helpers
 
 scale_utils
 
 scheduler_utils
 
 softmax_helpers
 
 support
 
 test
 
 utility
 
 utils
 
 weights_transformations
 
 wrapper
 

Data Structures

class  AccessWindowAutoPadding
 Dummy access window. More...
 
class  AccessWindowHorizontal
 Implementation of a row access pattern. More...
 
class  AccessWindowRectangle
 Implementation of a rectangular access pattern. More...
 
class  AccessWindowStatic
 Implementation of a static rectangular access pattern. More...
 
class  AccessWindowTranspose
 Implementation of a XY-transpose access pattern. More...
 
class  AccessWindowVertical
 Implementation of a column access pattern. More...
 
class  ActivationLayerInfo
 Activation Layer Information class. More...
 
class  Allocator
 Default malloc allocator implementation. More...
 
class  AllocatorWrapper
 Default malloc allocator implementation. More...
 
class  Array
 Basic implementation of the IArray interface which allocates a static number of T values. More...
 
class  bfloat16
 Brain floating point representation class. More...
 
struct  BlobInfo
 Meta-data information for each blob. More...
 
class  BlobLifetimeManager
 Concrete class that tracks the lifetime of registered tensors and calculates the systems memory requirements in terms of blobs. More...
 
class  BlobMemoryPool
 Blob memory pool. More...
 
struct  BorderSize
 Container for 2D border size. More...
 
class  BoundingBoxTransformInfo
 Bounding Box Transform information class. More...
 
class  BoxNMSLimitInfo
 BoxWithNonMaximaSuppressionLimit Information class. More...
 
class  CLAbsLayer
 Basic function to get the absolute value of an input tensor. More...
 
class  CLActivationLayer
 Basic function to run opencl::kernels::ClActivationKernel. More...
 
class  CLArgMinMaxLayer
 Function to calculate the index of the minimum or maximum values in a tensor based on an axis. More...
 
class  CLArgMinMaxLayerKernel
 Interface for the reduction operation kernel. More...
 
class  CLArithmeticAddition
 Basic function to run opencl::kernels::ClSaturatedArithmeticKernel for addition. More...
 
class  CLArithmeticDivision
 Basic function to run opencl::kernels::ClSaturatedArithmeticKernel for division. More...
 
class  CLArithmeticSubtraction
 Basic function to run opencl::kernels::ClSaturatedArithmeticKernel for subtraction. More...
 
class  CLArray
 CLArray implementation. More...
 
class  CLBatchNormalizationLayer
 Basic function to run CLNormalizationLayerKernel and simulate a batch normalization layer. More...
 
class  CLBatchNormalizationLayerKernel
 Interface for the BatchNormalization layer kernel. More...
 
class  CLBatchToSpaceLayer
 Basic function to run CLBatchToSpaceLayerKernel. More...
 
class  CLBatchToSpaceLayerKernel
 Interface for the batch to space kernel. More...
 
class  CLBitwiseAnd
 Basic function to perform bitwise AND by running CLBitwiseKernel. More...
 
class  CLBitwiseKernel
 Interface for the bitwise operation kernel. More...
 
class  CLBitwiseNot
 Basic function to perform bitwise NOT by running CLBitwiseKernel. More...
 
class  CLBitwiseOr
 Basic function to perform bitwise OR by running CLBitwiseKernel. More...
 
class  CLBitwiseXor
 Basic function to perform bitwise XOR by running CLBitwiseKernel. More...
 
class  CLBoundingBoxTransform
 Basic function to run CLBoundingBoxTransformKernel. More...
 
class  CLBoundingBoxTransformKernel
 Interface for the bounding box kernel. More...
 
class  CLBufferAllocator
 Default OpenCL cl buffer allocator implementation. More...
 
class  CLBufferMemoryRegion
 OpenCL buffer memory region implementation. More...
 
class  CLBuildOptions
 Build options. More...
 
class  CLCast
 Basic function to run opencl::kernels::ClCastKernel. More...
 
class  CLChannelShuffleLayer
 Basic function to run CLChannelShuffleLayerKernel. More...
 
class  CLChannelShuffleLayerKernel
 Interface for the channel shuffle kernel. More...
 
class  CLCoarseSVMMemoryRegion
 OpenCL coarse-grain SVM memory region implementation. More...
 
class  CLComparison
 Basic function to run CLComparisonKernel. More...
 
class  CLComparisonKernel
 Interface for the comparison kernel. More...
 
class  CLComparisonStatic
 Basic function to run CLComparisonKernel. More...
 
class  CLCompileContext
 CLCompileContext class. More...
 
class  CLComplexPixelWiseMultiplication
 Basic function to run opencl::ClComplexMul. More...
 
class  CLComputeAllAnchorsKernel
 Interface for Compute All Anchors kernel. More...
 
class  CLComputeMeanVariance
 Interface for compute Mean and Variance per channel. More...
 
class  CLConcatenateLayer
 Basic function to execute concatenate tensors along a given axis. More...
 
class  CLConv3D
 Basic function to compute the convolution3d layer. More...
 
class  CLConvertFullyConnectedWeights
 Basic function to run an opencl::kernels::ClConvertFullyConnectedWeightsKernel. More...
 
class  CLConvolutionLayer
 Basic function to compute the convolution layer. More...
 
class  CLCopy
 Basic function to run opencl::kernels::ClCopyKernel. More...
 
class  CLCrop
 Basic function to run opencl::kernels::ClCropKernel. More...
 
class  CLCropResize
 Function to perform cropping and resizing. More...
 
class  CLDeconvolutionLayer
 Basic function to compute the deconvolution layer. More...
 
class  CLDeconvolutionLayerUpsample
 Basic function to execute deconvolution upsample on OpenCL. More...
 
class  CLDeconvolutionLayerUpsampleKernel
 Interface for the Deconvolution layer kernel on OpenCL. More...
 
class  CLDeconvolutionReshapeOutputKernel
 Interface for the OpenCL kernel to be used for reshaping the tensor before returning the result of deconvolution. More...
 
class  CLDepthConvertLayer
 Basic function to run opencl::kernels::ClCastKernel. More...
 
class  CLDepthToSpaceLayer
 Basic function to run CLDepthToSpaceLayerKernel. More...
 
class  CLDepthToSpaceLayerKernel
 Interface for the depth to space kernel. More...
 
class  CLDepthwiseConvolutionLayer
 Function to execute a depthwise convolution. More...
 
class  CLDepthwiseConvolutionLayerNativeKernel
 Interface for the kernel to run a MxN depthwise convolution. More...
 
class  CLDequantizationLayer
 Basic function to run opencl::ClDequantize that dequantizes an input tensor. More...
 
class  CLDevice
 OpenCL device type class. More...
 
struct  CLDeviceOptions
 OpenCL device options. More...
 
class  CLDirectConvolutionLayer
 Basic function to execute direct convolution function: More...
 
class  CLDirectDeconvolutionLayer
 Function to run the deconvolution layer. More...
 
class  CLElementwiseMax
 Basic function to run opencl::kernels::ClArithmeticKernel for max. More...
 
class  CLElementwiseMin
 Basic function to run opencl::kernels::ClArithmeticKernel for min. More...
 
class  CLElementwisePower
 Basic function to run opencl::kernels::ClArithmeticKernel for power. More...
 
class  CLElementwiseSquaredDiff
 Basic function to run opencl::kernels::ClArithmeticKernel for squared difference. More...
 
class  CLExpLayer
 Basic function to perform exponential on an input tensor. More...
 
class  CLFFT1D
 Basic function to execute one dimensional FFT. More...
 
class  CLFFT2D
 Basic function to execute two dimensional FFT. More...
 
class  CLFFTConvolutionLayer
 Basic function to execute FFT-based convolution on OpenCL. More...
 
class  CLFFTDigitReverseKernel
 Interface for the digit reverse operation kernel. More...
 
class  CLFFTRadixStageKernel
 Interface for the FFT radix stage kernel. More...
 
class  CLFFTScaleKernel
 Interface for the inverse fft scale kernel. More...
 
class  CLFill
 Basic function to run opencl::kernels::ClFillKernel. More...
 
class  CLFillBorderKernel
 Interface for filling the border of a kernel. More...
 
class  CLFineSVMMemoryRegion
 OpenCL fine-grain SVM memory region implementation. More...
 
class  CLFlattenLayer
 Basic function to execute flatten. More...
 
class  CLFloor
 Basic function to run opencl::kernels::ClFloorKernel. More...
 
class  CLFullyConnectedLayer
 Basic function to compute a Fully Connected layer on OpenCL. More...
 
class  CLFuseBatchNormalization
 Basic function to fuse the batch normalization node to a preceding convolution node. More...
 
class  CLFuseBatchNormalizationKernel
 OpenCL kernel to fuse the batch normalization node to a preceding convolution node. More...
 
class  CLGather
 Basic function to run CLGatherKernel. More...
 
class  CLGatherKernel
 Interface for the kernel to perform tensor reshaping. More...
 
class  CLGEMM
 Basic function to execute GEMM on OpenCL. More...
 
class  CLGEMMConvolutionLayer
 Basic function to compute the convolution layer. More...
 
class  CLGEMMDeconvolutionLayer
 Function to run the deconvolution layer through a call to GEMM. More...
 
class  CLGEMMHeuristicsHandle
 Handle for loading and retrieving GEMM heuristics. More...
 
struct  CLGEMMKernelSelectionParams
 OpenCL GEMM kernel selection parameters. More...
 
class  CLGEMMLowpMatrixMultiplyCore
 Basic function to execute GEMMLowpMatrixMultiplyCore on OpenCL. More...
 
class  CLGEMMLowpOutputStage
 Basic function to execute GEMMLowpQuantizeDown kernels on CL. More...
 
class  CLGenerateProposalsLayer
 Basic function to generate proposals for a RPN (Region Proposal Network) More...
 
class  CLInstanceNormalizationLayer
 Basic function to perform a Instance normalization. More...
 
class  CLInstanceNormalizationLayerKernel
 Interface for performing an instance normalization. More...
 
class  CLKernelLibrary
 CLKernelLibrary class. More...
 
class  CLL2NormalizeLayer
 Basic function to perform a L2 normalization on a given axis. More...
 
class  CLL2NormalizeLayerKernel
 Interface for performing a L2 normalize on a given axis given the square sum of it in this axis. More...
 
class  CLLogicalAnd
 Basic function to run arm_compute::opencl::kernels::ClLogicalBinaryKernel. More...
 
class  CLLogicalNot
 Basic function to do logical NOT operation. More...
 
class  CLLogicalOr
 Basic function to run arm_compute::opencl::kernels::ClLogicalBinaryKernel. More...
 
class  CLLogLayer
 Basic function to perform elementwise log on an input tensor. More...
 
class  CLLSTMLayer
 This function performs a single time step in a Long Short-Term Memory (LSTM) layer. More...
 
class  CLLSTMLayerQuantized
 Basic function to run CLLSTMLayerQuantized. More...
 
class  CLMaxUnpoolingLayer
 Function to perform MaxUnpooling. More...
 
class  CLMaxUnpoolingLayerKernel
 Interface for the pooling layer kernel. More...
 
class  CLMeanStdDevNormalizationKernel
 Interface for the kernel to normalize the input 2D tensor across the first dimension with respect to mean and standard deviation of the same dimension. More...
 
class  CLMeanStdDevNormalizationLayer
 Basic function to execute mean and standard deviation normalization by calling CLMeanStdDevNormalizationKernel. More...
 
class  CLMemory
 OpenCL implementation of memory object. More...
 
class  CLNegLayer
 Basic function to negate an input tensor. More...
 
class  CLNormalizationLayer
 Basic function to compute a normalization layer. More...
 
class  CLNormalizationLayerKernel
 Interface for the normalization layer kernel. More...
 
class  CLNormalizePlanarYUVLayer
 Basic function to run CLNormalizePlanarYUVLayerKernel. More...
 
class  CLNormalizePlanarYUVLayerKernel
 Interface for the NormalizePlanarYUV layer kernel. More...
 
class  CLPadLayer
 Basic function to pad a tensor. More...
 
class  CLPadLayerKernel
 Interface for the PadLayer function. More...
 
class  CLPermute
 Basic function to execute an opencl::kernels::ClPermuteKernel. More...
 
class  CLPixelWiseMultiplication
 Basic function to run opencl::ClMul. More...
 
class  CLPooling3dLayer
 Basic function to run opencl::ClPool3d. More...
 
class  CLPoolingLayer
 Basic function to run opencl::ClPool2d. More...
 
class  CLPReluLayer
 Basic function to run opencl::kernels::ClArithmeticKernel for PRELU. More...
 
class  CLPriorBoxLayer
 Basic function to run CLPriorBoxLayerKernel. More...
 
class  CLPriorBoxLayerKernel
 Interface for the PriorBox layer kernel. More...
 
class  CLQLSTMLayer
 Basic function to run CLQLSTMLayer. More...
 
class  CLQLSTMLayerNormalizationKernel
 Interface for the kernel to do layer normalization. More...
 
struct  CLQuantization
 OpenCL quantization data. More...
 
class  CLQuantizationLayer
 Basic function to simulate a quantization layer. More...
 
class  CLRange
 Basic function to run CLRangeKernel. More...
 
class  CLRangeKernel
 Kernel class for Range. More...
 
class  CLReduceMean
 Basic function to perform reduce operation. More...
 
class  CLReductionOperation
 Perform reduction operation. More...
 
class  CLReductionOperationKernel
 Interface for the reduction operation kernel. More...
 
class  CLReorgLayer
 
class  CLReorgLayerKernel
 OpenCL kernel to perform a reorg layer. More...
 
class  CLReshapeLayer
 Basic function to run opencl::kernels::ClReshapeKernel. More...
 
class  CLReverse
 Basic function to run CLReverseKernel. More...
 
class  CLReverseKernel
 Interface for the reverse kernel. More...
 
class  CLRNNLayer
 Basic function to run CLRNNLayer. More...
 
class  CLROIAlignLayer
 Basic function to run CLROIAlignLayerKernel. More...
 
class  CLROIAlignLayerKernel
 Interface for the RoIAlign kernel. More...
 
class  CLROIPoolingLayer
 Basic function to run CLROIPoolingLayerKernel. More...
 
class  CLROIPoolingLayerKernel
 Interface for the ROI pooling layer kernel. More...
 
class  CLRoundLayer
 Basic function to get the round (to the nearest even) value of an input tensor. More...
 
class  CLRsqrtLayer
 Basic function to perform inverse square root on an input tensor. More...
 
class  CLRuntimeContext
 Runtime context. More...
 
class  CLScale
 Basic function to run opencl::ClScale. More...
 
class  CLScheduler
 Provides global access to a CL context and command queue. More...
 
class  CLSelect
 Basic function to run CLSelect. More...
 
class  CLSelectKernel
 OpenCL interface for executing the select kernel. More...
 
class  CLSinLayer
 Basic function to calculate sine of an input tensor. More...
 
class  CLSlice
 Basic function to perform tensor slicing. More...
 
class  CLSoftmaxLayerGeneric
 Basic function to compute a SoftmaxLayer. More...
 
class  CLSpaceToBatchLayer
 Basic function to spatial divide a tensor. More...
 
class  CLSpaceToBatchLayerKernel
 Interface for the space to batch kernel. More...
 
class  CLSpaceToDepthLayer
 Basic function to run CLSpaceToDepthLayerKernel. More...
 
class  CLSpaceToDepthLayerKernel
 Interface for the space to depth kernel. More...
 
class  CLSplit
 Basic function to split a tensor along a given axis. More...
 
class  CLStackLayer
 Basic function to stack tensors along an axis. More...
 
class  CLStackLayerKernel
 OpenCL kernel to stacks a rank-R tensor into one with rank-(R+1) along the axis dimension. More...
 
class  CLStridedSlice
 Basic function to run CLStridedSliceKernel. More...
 
class  CLStridedSliceKernel
 Interface for the kernel to perform tensor strided slicing. More...
 
class  CLSubTensor
 Basic implementation of the OpenCL sub-tensor interface. More...
 
class  CLSymbols
 Class for loading OpenCL symbols. More...
 
class  CLTensor
 Basic implementation of the OpenCL tensor interface. More...
 
class  CLTensorAllocator
 Basic implementation of a CL memory tensor allocator. More...
 
class  CLTile
 Basic function to run CLTileKernel. More...
 
class  CLTileKernel
 OpenCL kernel to perform a Tile operation. More...
 
class  CLTranspose
 Basic function to execute an opencl::kernels::ClTransposeKernel. More...
 
class  CLTuner
 Basic implementation of the OpenCL tuner interface. More...
 
struct  CLTuningInfo
 
class  CLTuningParams
 < OpenCL tuner parameters More...
 
class  CLUnstack
 Basic function to unpack a rank-R tensor into rank-(R-1) tensors. More...
 
class  CLWinogradConvolutionLayer
 Basic function to execute Winograd-based convolution on OpenCL. More...
 
class  ComputeAnchorsInfo
 ComputeAnchors information class. More...
 
struct  Conv2dInfo
 Descriptor used by the 2d Convolution function. More...
 
struct  Conv3dInfo
 Descriptor used by the 3d Convolution function. More...
 
struct  ConvolutionInfo
 
class  Coordinates
 Coordinates of an item. More...
 
struct  Coordinates2D
 Coordinate type. More...
 
struct  Coordinates3D
 Coordinate type. More...
 
class  CPPBoxWithNonMaximaSuppressionLimit
 Basic function to run CPPBoxWithNonMaximaSuppressionLimitKernel. More...
 
class  CPPBoxWithNonMaximaSuppressionLimitKernel
 CPP kernel to perform computation of BoxWithNonMaximaSuppressionLimit. More...
 
class  CPPDetectionOutputLayer
 CPP Function to generate the detection output based on location and confidence predictions by doing non maximum suppression. More...
 
class  CPPDetectionPostProcessLayer
 CPP Function to generate the detection output based on center size encoded boxes, class prediction and anchors by doing non maximum suppression. More...
 
class  CPPNonMaximumSuppression
 CPP Function to perform non maximum suppression on the bounding boxes and scores. More...
 
class  CPPNonMaximumSuppressionKernel
 CPP Function to perform non maximum suppression on the bounding boxes and scores. More...
 
class  CPPPermute
 Basic function to run CPPPermuteKernel. More...
 
class  CPPPermuteKernel
 CPP kernel to perform tensor permutation. More...
 
class  CPPScheduler
 C++11 implementation of a pool of threads to automatically split a kernel's execution among several threads. More...
 
class  CPPSplit
 Basic function to split a tensor along a given axis. More...
 
class  CPPTopKV
 Basic function to run CPPTopKVKernel. More...
 
class  CPPTopKVKernel
 CPP kernel to perform tensor TopKV operation. More...
 
class  CPPUpsample
 Basic function to run CPPUpsample. More...
 
class  CPPUpsampleKernel
 CPP kernel to perform tensor upsample. More...
 
class  CPUInfo
 
class  DetectionOutputLayerInfo
 Detection Output layer info. More...
 
class  DetectionPostProcessLayerInfo
 Detection Output layer info. More...
 
struct  DetectionWindow
 Detection window used for the object detection. More...
 
class  Dimensions
 Dimensions with dimensionality. More...
 
struct  DirectConvComputeKernelInfo
 Compute descriptor used by the direct convolution kernel. More...
 
struct  DirectConvolutionLayerOutputStageKernelInfo
 Descriptor used by the direct convolution layer output stage kernels. More...
 
struct  DWCComputeKernelInfo
 Compute descriptor used by the depthwise convolution native kernel. More...
 
struct  enable_bitwise_ops
 Disable bitwise operations by default. More...
 
struct  enable_bitwise_ops< arm_compute::GPUTarget >
 Enable bitwise operations on GPUTarget enumerations. More...
 
struct  FFT1DInfo
 Descriptor used by the FFT1D function. More...
 
struct  FFT2DInfo
 Descriptor used by the FFT2D function. More...
 
struct  FFTDigitReverseKernelInfo
 Descriptor for FFT digit reverse kernels. More...
 
struct  FFTRadixStageKernelInfo
 Descriptor used by the FFT core kernels. More...
 
struct  FFTScaleKernelInfo
 Descriptor for FFT scale kernels. More...
 
struct  FullyConnectedLayerInfo
 Fully connected layer info. More...
 
class  GEMMInfo
 GEMM information class. More...
 
struct  GEMMKernelInfo
 Descriptor used by the GEMM kernels. More...
 
struct  GEMMLHSMatrixInfo
 GEMM LHS (Left Hand Side) matrix information. More...
 
struct  GEMMLowpOutputStageInfo
 GEMMLowp output stage info. More...
 
struct  GEMMLowpReductionKernelInfo
 
class  GEMMReshapeInfo
 GEMM reshape information class. More...
 
struct  GEMMRHSMatrixInfo
 GEMM RHS (Right Hand Side) matrix information. More...
 
class  GenerateProposalsInfo
 Generate Proposals Information class. More...
 
class  IAccessWindow
 Interface describing methods to update access window and padding based on kernel parameters. More...
 
class  IAllocator
 Allocator interface. More...
 
class  IArray
 Array of type T. More...
 
class  IAssetManager
 Asset manager interface. More...
 
class  ICLArray
 Interface for OpenCL Array. More...
 
class  ICLKernel
 Common interface for all the OpenCL kernels. More...
 
class  ICLMemoryRegion
 OpenCL memory region interface. More...
 
class  ICLSimple2DKernel
 Interface for simple OpenCL kernels having 1 tensor input and 1 tensor output. More...
 
class  ICLSimple3DKernel
 Interface for simple OpenCL kernels having 1 tensor input and 1 tensor output. More...
 
class  ICLSimpleFunction
 Basic interface for functions which have a single OpenCL kernel. More...
 
class  ICLSimpleKernel
 Interface for simple OpenCL kernels having 1 tensor input and 1 tensor output. More...
 
class  ICLSVMMemoryRegion
 OpenCL SVM memory region interface. More...
 
class  ICLTensor
 Interface for OpenCL tensor. More...
 
class  ICLTuner
 Basic interface for tuning the OpenCL kernels. More...
 
class  IContext
 Context interface. More...
 
class  ICPPKernel
 Common interface for all kernels implemented in C++. More...
 
class  ICPPSimpleFunction
 Basic interface for functions which have a single CPP kernel. More...
 
class  IDevice
 Interface for device object. More...
 
class  IFunction
 Base class for all functions. More...
 
class  IKernel
 Common information for all the kernels. More...
 
class  ILifetimeManager
 Interface for managing the lifetime of objects. More...
 
class  IMemory
 Memory interface. More...
 
class  IMemoryGroup
 Memory group interface. More...
 
class  IMemoryManageable
 Interface of an object than can be memory managed. More...
 
class  IMemoryManager
 Memory manager interface to handle allocations of backing memory. More...
 
class  IMemoryPool
 Memory Pool Inteface. More...
 
class  IMemoryRegion
 Memory region interface. More...
 
class  INESimpleFunction
 Basic interface for functions which have a single CPU kernel. More...
 
class  INESimpleFunctionNoBorder
 Basic interface for functions which have a single CPU kernel and no border. More...
 
struct  InstanceNormalizationLayerKernelInfo
 
struct  IOFormatInfo
 IO formatting information class. More...
 
class  IOperator
 Base class specifying the operator interface. More...
 
class  IPoolManager
 Memory pool manager interface. More...
 
class  IQueue
 Base class specifying the queue interface. More...
 
class  IRuntimeContext
 Context interface. More...
 
class  IScheduler
 Scheduler interface to run kernels. More...
 
class  ISimpleLifetimeManager
 Abstract class of the simple lifetime manager interface. More...
 
class  ITensor
 Interface for CPU tensor. More...
 
class  ITensorAllocator
 Interface to allocate tensors. More...
 
class  ITensorInfo
 Store the tensor's metadata. More...
 
class  ITensorPack
 Tensor packing service. More...
 
class  ITensorV2
 Base class specifying the tensor interface. More...
 
class  Iterator
 Iterator updated by execute_window_loop for each window element. More...
 
class  ITransformWeights
 Weights tensor transform interface In order to identify the different reshape functions, each reshape function has to generate a unique id. More...
 
class  IWeightsManager
 Weights manager interface to handle weights transformations. More...
 
class  Kernel
 Kernel class. More...
 
class  LSTMParams
 
class  Memory
 CPU implementation of memory object. More...
 
class  MemoryGroup
 Memory group. More...
 
class  MemoryGroupResourceScope
 Memory group resources scope handling class. More...
 
class  MemoryManagerOnDemand
 On-demand memory manager. More...
 
class  MemoryRegion
 Memory region CPU implementation. More...
 
struct  MinMaxLocationValues
 Min and max values and locations. More...
 
class  NEActivationLayer
 Basic function to run cpu::kernels::CpuActivationKernel. More...
 
class  NEArgMinMaxLayer
 Function to calculate the index of the minimum or maximum values in a tensor based on an axis. More...
 
class  NEArithmeticAddition
 Basic function to run cpu::kernels::CpuAddKernel. More...
 
class  NEArithmeticSubtraction
 Basic function to run cpu::kernels::CpuSubKernel. More...
 
class  NEBatchNormalizationLayer
 Basic function to run NENormalizationLayerKernel and simulate a batch normalization layer. More...
 
class  NEBatchNormalizationLayerKernel
 Interface for the batch normalization layer kernel. More...
 
class  NEBatchToSpaceLayer
 Basic function to run NEBatchToSpaceLayerKernel. More...
 
class  NEBatchToSpaceLayerKernel
 Interface for the batch to space kernel. More...
 
class  NEBitwiseAnd
 Basic function to run NEBitwiseAndKernel. More...
 
class  NEBitwiseAndKernel
 Interface for the kernel to perform bitwise AND between XY-planes of two tensors. More...
 
class  NEBitwiseNot
 Basic function to run NEBitwiseNotKernel. More...
 
class  NEBitwiseNotKernel
 Interface for the kernel to perform bitwise NOT operation. More...
 
class  NEBitwiseOr
 Basic function to run NEBitwiseOrKernel. More...
 
class  NEBitwiseOrKernel
 Interface for the kernel to perform bitwise inclusive OR between two tensors. More...
 
class  NEBitwiseXor
 Basic function to run NEBitwiseXorKernel. More...
 
class  NEBitwiseXorKernel
 Interface for the kernel to perform bitwise exclusive OR (XOR) between two tensors. More...
 
class  NEBoundingBoxTransform
 Basic function to run NEBoundingBoxTransformKernel. More...
 
class  NEBoundingBoxTransformKernel
 Interface for the bounding box kernel. More...
 
class  NECast
 Basic function to run cpu::kernels::CpuCastKernel. More...
 
class  NEChannelShuffleLayer
 Basic function to run NEChannelShuffleLayerKernel. More...
 
class  NEChannelShuffleLayerKernel
 Interface for the channel shuffle kernel. More...
 
class  NECol2ImKernel
 Kernel to perform col2im reshaping. More...
 
class  NEComplexPixelWiseMultiplication
 Basic function to run cpu::CpuComplexMul. More...
 
class  NEComputeAllAnchorsKernel
 Interface for Compute All Anchors kernel. More...
 
class  NEConcatenateLayer
 Basic function to execute concatenate tensors along a given axis. More...
 
class  NEConv3D
 Basic function to simulate a 3d convolution. More...
 
class  NEConvertFullyConnectedWeights
 Basic function to run cpu::kernels::CpuConvertFullyConnectedWeightsKernel. More...
 
class  NEConvolutionLayer
 Basic function to simulate a convolution layer. More...
 
class  NECopy
 Basic function to run cpu::kernels::CpuCopyKernel. More...
 
class  NECropKernel
 Interface for the kernel to perform tensor cropping. More...
 
class  NECropResize
 Function to perform cropping and resizing. More...
 
class  NEDeconvolutionLayer
 Function to run the deconvolution layer. More...
 
class  NEDepthConvertLayer
 Basic function to run cpu::kernels::CpuCastKernel. More...
 
class  NEDepthToSpaceLayer
 Basic function to run NEDepthToSpaceLayerKernel. More...
 
class  NEDepthToSpaceLayerKernel
 Interface for the depth to space kernel. More...
 
class  NEDepthwiseConvolutionLayer
 Function to execute a depthwise convolution. More...
 
class  NEDequantizationLayer
 Basic function to run cpu::CpuDequantize that dequantizes an input tensor. More...
 
class  NEDetectionPostProcessLayer
 NE Function to generate the detection output based on center size encoded boxes, class prediction and anchors by doing non maximum suppression. More...
 
class  NEDirectConvolutionLayer
 Function to run the direct convolution. More...
 
class  NEElementwiseComparison
 Basic function to run cpu::kernels::CpuComparisonKernel. More...
 
class  NEElementwiseComparisonStatic
 Basic function to run cpu::kernels::CpuComparisonKernel. More...
 
class  NEElementwiseDivision
 Basic function to run cpu::kernels::CpuArithmeticKernel for division. More...
 
class  NEElementwiseMax
 Basic function to run cpu::kernels::CpuArithmeticKernel for max. More...
 
class  NEElementwiseMin
 Basic function to run cpu::kernels::CpuArithmeticKernel for min. More...
 
class  NEElementwisePower
 Basic function to run cpu::kernels::CpuArithmeticKernel for power. More...
 
class  NEElementwiseSquaredDiff
 Basic function to run cpu::kernels::CpuArithmeticKernel for squared difference. More...
 
class  NEElementwiseUnaryLayer
 Basic function to perform unary elementwise operations. More...
 
class  NEFFT1D
 Basic function to execute one dimensional FFT. More...
 
class  NEFFT2D
 Basic function to execute two dimensional FFT. More...
 
class  NEFFTConvolutionLayer
 Basic function to execute FFT-based convolution on CPU. More...
 
class  NEFFTDigitReverseKernel
 Interface for the digit reverse operation kernel. More...
 
class  NEFFTRadixStageKernel
 Interface for the FFT kernel. More...
 
class  NEFFTScaleKernel
 Interface for the inverse fft scale kernel. More...
 
class  NEFill
 Basic function to run cpu::kernels::CpuFillKernel. More...
 
class  NEFillBorder
 Basic function to run NEFillBorderKernel. More...
 
class  NEFillBorderKernel
 Interface for the kernel to fill borders. More...
 
class  NEFlattenLayer
 Basic function to execute flatten layer kernel. More...
 
class  NEFloor
 Basic function to run cpu::kernels::CpuFloorKernel. More...
 
class  NEFullyConnectedLayer
 Basic function to compute a Fully Connected layer. More...
 
class  NEFuseBatchNormalization
 Basic function to fuse the batch normalization node to a preceding convolution node. More...
 
class  NEFuseBatchNormalizationKernel
 OpenNE kernel to fuse the batch normalization node to a preceding convolution node. More...
 
class  NEGather
 Basic function to run NEGatherKernel. More...
 
class  NEGatherKernel
 Kernel to perform gather operation. More...
 
class  NEGEMM
 Basic function to execute GEMM. More...
 
class  NEGEMMConv2d
 Basic function to compute the convolution layer. More...
 
class  NEGEMMConvolutionLayer
 Basic function to compute the convolution layer. More...
 
class  NEGEMMLowpMatrixMultiplyCore
 Function to run Gemm on quantized types. More...
 
class  NEGEMMLowpOutputStage
 Basic function to execute GEMMLowpQuantizeDown kernels. More...
 
class  NEGenerateProposalsLayer
 Basic function to generate proposals for a RPN (Region Proposal Network) More...
 
class  NEInstanceNormalizationLayer
 Basic function to perform a Instance normalization. More...
 
class  NEInstanceNormalizationLayerKernel
 Interface for performing an instance normalization. More...
 
class  NEL2NormalizeLayer
 Basic function to perform a L2 normalization on a given axis. More...
 
class  NEL2NormalizeLayerKernel
 Interface for performing a L2 normalize on a given axis given the square sum of it in this axis. More...
 
class  NELogicalAnd
 Basic function to perform logical AND. More...
 
class  NELogicalNot
 Basic function to perform logical NOT. More...
 
class  NELogicalOr
 Basic function to perform logical OR. More...
 
class  NELSTMLayer
 Basic function to run NELSTMLayer. More...
 
class  NELSTMLayerQuantized
 Basic function to run NELSTMLayerQuantized. More...
 
class  NEMaxUnpoolingLayer
 Function to perform MaxUnpooling. More...
 
class  NEMeanStdDevNormalizationKernel
 Interface for the kernel to normalize the input 2D tensor across the first dimension with respect to mean and standard deviation of the same dimension. More...
 
class  NEMeanStdDevNormalizationLayer
 Basic function to execute mean and standard deviation normalization by calling NEMeanStdDevNormalizationKernel. More...
 
class  NENormalizationLayer
 Basic function to compute a normalization layer. More...
 
class  NENormalizationLayerKernel
 Interface for the normalization layer kernel. More...
 
class  NEPadLayer
 Basic function to pad a tensor. More...
 
class  NEPadLayerKernel
 Basic kernel to pad the input tensor given padding information. More...
 
class  NEPermute
 Basic function to run cpu::kernels::CpuPermuteKernel. More...
 
class  NEPixelWiseMultiplication
 Basic function to run cpu::CpuMul. More...
 
class  NEPooling3dLayer
 Basic function to simulate a pooling 3d layer with the specified pooling operation. More...
 
class  NEPoolingLayer
 Basic function to simulate a pooling layer with the specified pooling operation. More...
 
class  NEPReluLayer
 Basic function to run cpu::kernels::CpuArithmeticKernel for PRELU. More...
 
class  NEPriorBoxLayer
 Basic function to run NEPriorBoxLayerKernel. More...
 
class  NEPriorBoxLayerKernel
 Interface for the kernel to calculate prior boxes. More...
 
class  NEQLSTMLayer
 Basic function to run NEQLSTMLayer. More...
 
class  NEQLSTMLayerNormalizationKernel
 Kernel to perform layer normalization for QLSTM. More...
 
class  NEQuantizationLayer
 Basic function to run a quantization layer using cpu::CpuQuantize. More...
 
class  NERange
 Basic function to run NERangeKernel. More...
 
class  NERangeKernel
 Kernel class for Range. More...
 
class  NEReduceMean
 Basic function to perform reduce operation. More...
 
class  NEReductionOperation
 Basic function to simulate a reduction operation. More...
 
class  NEReductionOperationKernel
 Kernel to perform a reduction operation. More...
 
class  NEReorgLayer
 Basic function to run NEReorgLayerKernel. More...
 
class  NEReorgLayerKernel
 Interface for the kernel to perform tensor re-organization. More...
 
class  NEReshapeLayer
 Basic function to run cpu::kernels::CpuReshapeKernel. More...
 
class  NEReverse
 Basic function to run NEReverseKernel. More...
 
class  NEReverseKernel
 Interface for the reverse layer kernel. More...
 
class  NERNNLayer
 Basic function to run NERNNLayer. More...
 
class  NEROIAlignLayer
 Basic function to run NEROIAlignLayerKernel. More...
 
class  NEROIAlignLayerKernel
 Interface for the RoIAlign kernel. More...
 
class  NEROIPoolingLayer
 Basic function to run NEROIPoolingLayerKernel. More...
 
class  NEROIPoolingLayerKernel
 Interface for the ROI pooling layer kernel. More...
 
class  NEScale
 Basic function to compute Scale. More...
 
class  NESelect
 Basic function to run NESelect. More...
 
class  NESelectKernel
 Interface for the select kernel. More...
 
class  NESlice
 Basic function to perform tensor slicing. More...
 
class  NESoftmaxLayerGeneric
 Basic function to compute a SoftmaxLayer and a Log SoftmaxLayer. More...
 
class  NESpaceToBatchLayer
 Basic function to spatial divide a tensor. More...
 
class  NESpaceToBatchLayerKernel
 Interface for the space to batch kernel. More...
 
class  NESpaceToDepthLayer
 Basic function to run NESpaceToDepthLayerKernel. More...
 
class  NESpaceToDepthLayerKernel
 Interface for the space to depth kernel. More...
 
class  NESplit
 Basic function to split a tensor along a given axis. More...
 
class  NEStackLayer
 Basic function to stack tensors along an axis. More...
 
class  NEStackLayerKernel
 Basic kernel to stack a rank-R tensor into one with rank-(R+1) along the axis dimension. More...
 
class  NEStridedSlice
 Basic function to run NEStridedSliceKernel. More...
 
class  NEStridedSliceKernel
 Interface for the kernel to perform tensor strided slicing. More...
 
class  NETile
 Basic function to run NETileKernel. More...
 
class  NETileKernel
 Basic kernel to perform a tile operation. More...
 
class  NETranspose
 Basic function to run cpu::kernels::CpuTransposeKernel. More...
 
class  NEUnstack
 Basic function to unpack a rank-R tensor into rank-(R-1) tensors. More...
 
class  NEWinogradConvolutionLayer
 Basic function to simulate a convolution layer. More...
 
class  NormalizationLayerInfo
 Normalization Layer Information class. More...
 
class  OffsetLifetimeManager
 Concrete class that tracks the lifetime of registered tensors and calculates the systems memory requirements in terms of a single blob and a list of offsets. More...
 
class  OffsetMemoryPool
 Offset based memory pool. More...
 
class  OMPScheduler
 Pool of threads to automatically split a kernel's execution among several threads. More...
 
struct  Padding2D
 Padding information for 2D operations like Conv2d. More...
 
struct  Padding3D
 Padding information for 3D operations like Conv3d. More...
 
class  PadStrideInfo
 Padding and stride information class. More...
 
class  PixelValue
 Class describing the value of a pixel for any image format. More...
 
struct  Pooling3dLayerInfo
 Pooling Layer Information struct. More...
 
struct  PoolingLayerInfo
 Pooling Layer Information struct. More...
 
class  PoolManager
 Memory pool manager. More...
 
class  PriorBoxLayerInfo
 PriorBox layer info. More...
 
class  Program
 Program class. More...
 
struct  Qasymm8QuantizationHelper
 
class  QuantizationInfo
 Quantization information. More...
 
struct  Rectangle
 Rectangle type. More...
 
class  ROIPoolingLayerInfo
 ROI Pooling Layer Information class. More...
 
class  RuntimeContext
 Runtime context. More...
 
struct  ScaleKernelInfo
 
class  Scheduler
 Configurable scheduler which supports multiple multithreading APIs and choosing between different schedulers at runtime. More...
 
class  SchedulerFactory
 Scheduler Factory. More...
 
class  Semaphore
 Semamphore class. More...
 
class  SingleThreadScheduler
 Pool of threads to automatically split a kernel's execution among several threads. More...
 
class  Size2D
 Class for specifying the size of an image or rectangle. More...
 
class  Size3D
 Class for specifying the size of a 3D shape or object. More...
 
struct  SoftmaxKernelInfo
 Descriptor used by the softmax kernels. More...
 
class  Status
 Status class. More...
 
class  Steps
 Class to describe a number of elements in each dimension. More...
 
class  StridedSliceLayerInfo
 
class  Strides
 Strides of an item in bytes. More...
 
class  SubTensor
 Basic implementation of the sub-tensor interface. More...
 
class  SubTensorInfo
 Store the sub tensor's metadata. More...
 
class  Tensor
 Basic implementation of the tensor interface. More...
 
class  TensorAccessor
 Tensor accessors to make it easier to interface with arm_gemm. More...
 
class  TensorAllocator
 Basic implementation of a CPU memory tensor allocator. More...
 
class  TensorInfo
 Store the tensor's metadata. More...
 
class  TensorPack
 Tensor packing service. More...
 
class  TensorShape
 Shape of a tensor. More...
 
struct  ThreadInfo
 Information about executing thread and CPU. More...
 
struct  UniformQuantizationInfo
 Quantization info when assuming per layer quantization. More...
 
struct  ValidRegion
 Container for valid region of a window. More...
 
class  WeightsInfo
 Convolution Layer Weights Information class. More...
 
class  Window
 Describe a multidimensional execution window. More...
 
class  WindowIterator
 Iterate over a portion of a Window. More...
 
struct  WinogradInfo
 Winograd information. More...
 
struct  WorkspaceDataElement
 

Typedefs

using ICLUInt8Array = ICLArray< cl_uchar >
 Interface for OpenCL Array of uint8s. More...
 
using ICLUInt16Array = ICLArray< cl_ushort >
 Interface for OpenCL Array of uint16s. More...
 
using ICLUInt32Array = ICLArray< cl_uint >
 Interface for OpenCL Array of uint32s. More...
 
using ICLInt16Array = ICLArray< cl_short >
 Interface for OpenCL Array of int16s. More...
 
using ICLInt32Array = ICLArray< cl_int >
 Interface for OpenCL Array of int32s. More...
 
using ICLFloatArray = ICLArray< cl_float >
 Interface for OpenCL Array of floats. More...
 
using ICLImage = ICLTensor
 
using IUInt8Array = IArray< uint8_t >
 Interface for Array of uint8s. More...
 
using IUInt16Array = IArray< uint16_t >
 Interface for Array of uint16s. More...
 
using IUInt32Array = IArray< uint32_t >
 Interface for Array of uint32s. More...
 
using IInt16Array = IArray< int16_t >
 Interface for Array of int16s. More...
 
using IInt32Array = IArray< int32_t >
 Interface for Array of int32s. More...
 
using IFloatArray = IArray< float >
 Interface for Array of floats. More...
 
using IImage = ITensor
 
using qasymm8_signed_t = int8_t
 8 bit signed quantized asymmetric scalar value More...
 
using qasymm8_t = uint8_t
 8 bit quantized asymmetric scalar value More...
 
using qsymm16_t = int16_t
 16 bit quantized symmetric scalar value More...
 
using qasymm16_t = uint16_t
 16 bit quantized asymmetric scalar value More...
 
using half = half_float::half
 16-bit floating point type More...
 
using PermutationVector = Strides
 Permutation vector. More...
 
using BiStrides = Coordinates
 Bidirectional strides. More...
 
using PaddingSize = BorderSize
 Container for 2D padding size. More...
 
using PaddingInfo = std::pair< uint32_t, uint32_t >
 Padding information as a pair of unsigned int start/end. More...
 
using PaddingList = std::vector< PaddingInfo >
 List of padding information. More...
 
using Multiples = std::vector< uint32_t >
 Information to produce a tiled version of a Tensor. More...
 
using BBox = std::array< float, 4 >
 
using LabelBBox = std::map< int, std::vector< BBox > >
 
using UInt8Array = Array< uint8_t >
 Array of uint8s. More...
 
using UInt16Array = Array< uint16_t >
 Array of uint16s. More...
 
using UInt32Array = Array< uint32_t >
 Array of uint32s. More...
 
using Int16Array = Array< int16_t >
 Array of int16s. More...
 
using Int32Array = Array< int32_t >
 Array of int32s. More...
 
using FloatArray = Array< float >
 Array of floats. More...
 
using CLUInt8Array = CLArray< cl_uchar >
 OpenCL Array of uint8s. More...
 
using CLUInt16Array = CLArray< cl_ushort >
 OpenCL Array of uint16s. More...
 
using CLUInt32Array = CLArray< cl_uint >
 OpenCL Array of uint32s. More...
 
using CLInt16Array = CLArray< cl_short >
 OpenCL Array of int16s. More...
 
using CLInt32Array = CLArray< cl_int >
 OpenCL Array of int32s. More...
 
using CLFloatArray = CLArray< cl_float >
 OpenCL Array of floats. More...
 
using CLImage = CLTensor
 OpenCL Image. More...
 
using CLEqual = CLComparisonStatic< ComparisonOperation::Equal >
 Basic function to run equal comparison. More...
 
using CLNotEqual = CLComparisonStatic< ComparisonOperation::NotEqual >
 Basic function to run not equal comparison. More...
 
using CLGreater = CLComparisonStatic< ComparisonOperation::Greater >
 Basic function to run greater comparison. More...
 
using CLGreaterEqual = CLComparisonStatic< ComparisonOperation::GreaterEqual >
 Basic function to run greater-equal comparison. More...
 
using CLLess = CLComparisonStatic< ComparisonOperation::Less >
 Basic function to run less comparison. More...
 
using CLLessEqual = CLComparisonStatic< ComparisonOperation::LessEqual >
 Basic function to run less-equal comparison. More...
 
using CLSoftmaxLayer = CLSoftmaxLayerGeneric< false >
 
using CLLogSoftmaxLayer = CLSoftmaxLayerGeneric< true >
 
using NEEqual = NEElementwiseComparisonStatic< ComparisonOperation::Equal >
 Basic function to run equal comparison. More...
 
using NENotEqual = NEElementwiseComparisonStatic< ComparisonOperation::NotEqual >
 Basic function to run not equal comparison. More...
 
using NEGreater = NEElementwiseComparisonStatic< ComparisonOperation::Greater >
 Basic function to run greater comparison. More...
 
using NEGreaterEqual = NEElementwiseComparisonStatic< ComparisonOperation::GreaterEqual >
 Basic function to run greater-equal comparison. More...
 
using NELess = NEElementwiseComparisonStatic< ComparisonOperation::Less >
 Basic function to run less comparison. More...
 
using NELessEqual = NEElementwiseComparisonStatic< ComparisonOperation::LessEqual >
 Basic function to run less-equal comparison. More...
 
using NERsqrtLayer = NEElementwiseUnaryLayer< ElementWiseUnary::RSQRT >
 
using NEExpLayer = NEElementwiseUnaryLayer< ElementWiseUnary::EXP >
 
using NENegLayer = NEElementwiseUnaryLayer< ElementWiseUnary::NEG >
 
using NELogLayer = NEElementwiseUnaryLayer< ElementWiseUnary::LOG >
 
using NEAbsLayer = NEElementwiseUnaryLayer< ElementWiseUnary::ABS >
 
using NERoundLayer = NEElementwiseUnaryLayer< ElementWiseUnary::ROUND >
 
using NESinLayer = NEElementwiseUnaryLayer< ElementWiseUnary::SIN >
 
using NESoftmaxLayer = NESoftmaxLayerGeneric< false >
 
using NELogSoftmaxLayer = NESoftmaxLayerGeneric< true >
 
using INEKernel = ICPPKernel
 Common interface for all kernels implemented in Neon. More...
 
using NEScheduler = Scheduler
 CPU Scheduler. More...
 
using Image = Tensor
 Image. More...
 
using MemoryMappings = std::map< IMemory *, size_t >
 A map of (handle, index/offset), where handle is the memory handle of the object to provide the memory for and index/offset is the buffer/offset from the pool that should be used. More...
 
using GroupMappings = std::map< size_t, MemoryMappings >
 A map of the groups and memory mappings. More...
 
using MemoryRequirements = experimental::MemoryRequirements
 
template<typename TensorType >
using WorkspaceData = std::vector< WorkspaceDataElement< TensorType > >
 
using qasymm8x8_t = uint8x8_t
 8 bit quantized asymmetric vector with 8 elements More...
 
using qasymm8x8x2_t = uint8x8x2_t
 8 bit quantized asymmetric vector with 16 elements More...
 
using qasymm8x8x3_t = uint8x8x3_t
 8 bit quantized asymmetric vector with 24 elements More...
 
using qasymm8x8x4_t = uint8x8x4_t
 8 bit quantized asymmetric vector with 32 elements More...
 
using qasymm8x16_t = uint8x16_t
 8 bit quantized asymmetric vector with 16 elements More...
 
using qasymm8x8_signed_t = int8x8_t
 8 bit quantized signed asymmetric vector with 8 elements More...
 
using qasymm8x8x2_signed_t = int8x8x2_t
 8 bit quantized signed asymmetric vector with 16 elements More...
 
using qasymm8x8x3_signed_t = int8x8x3_t
 8 bit quantized signed asymmetric vector with 24 elements More...
 
using qasymm8x8x4_signed_t = int8x8x4_t
 8 bit quantized signed asymmetric vector with 32 elements More...
 
using qasymm8x16_signed_t = int8x16_t
 8 bit quantized signed asymmetric vector with 16 elements More...
 
using qsymm8_t = int8_t
 8 bit quantized symmetric scalar value More...
 
using qsymm16x8_t = int16x8_t
 16 bit quantized symmetric vector with 8 elements More...
 
using qsymm16x8x2_t = int16x8x2_t
 16 bit quantized symmetric vector with 16 elements More...
 
using OperatorType = opencl::ClGemm
 
using Mutex = std::mutex
 Wrapper of Mutex data-object. More...
 
template<typename Mutex >
using lock_guard = std::lock_guard< Mutex >
 Wrapper of lock_guard data-object. More...
 
template<typename Mutex >
using unique_lock = std::unique_lock< Mutex >
 Wrapper of lock_guard data-object. More...
 

Enumerations

enum  CLVersion {
  CL10, CL11, CL12, CL20,
  CL30, UNKNOWN
}
 Available OpenCL Version. More...
 
enum  CLKernelType {
  UNKNOWN, UNKNOWN, DEPTHWISE, DIRECT,
  ELEMENTWISE, GEMM, POOL, WINOGRAD
}
 
enum  CPUModel {
  X, GENERIC, GENERIC_FP16, GENERIC_FP16_DOT,
  A53, A55r0, A55r1, A35,
  A73, A76, A510, X1,
  V1, A64FX
}
 CPU models types. More...
 
enum  ErrorCode { OK, RUNTIME_ERROR, UNSUPPORTED_EXTENSION_USE }
 Available error codes. More...
 
enum  TensorType : int32_t {
  ACL_UNKNOWN = -1, ACL_SRC_DST = 0, ACL_SRC = 0, ACL_SRC_0 = 0,
  ACL_SRC_1 = 1, ACL_SRC_2 = 2, ACL_SRC_3 = 3, ACL_SRC_4 = 4,
  ACL_SRC_5 = 5, ACL_SRC_6 = 6, ACL_SRC_END = 6, ACL_DST = 30,
  ACL_DST_0 = 30, ACL_DST_1 = 31, ACL_DST_2 = 32, ACL_DST_END = 32,
  ACL_INT = 50, ACL_INT_0 = 50, ACL_INT_1 = 51, ACL_INT_2 = 52,
  ACL_INT_3 = 53, ACL_INT_4 = 54, ACL_SRC_VEC = 256, ACL_DST_VEC = 512,
  ACL_INT_VEC = 1024, ACL_BIAS = ACL_SRC_2, ACL_VEC_ROW_SUM = ACL_SRC_3, ACL_VEC_COL_SUM = ACL_SRC_4,
  ACL_SHIFTS = ACL_SRC_5, ACL_MULTIPLIERS = ACL_SRC_6, EXPERIMENTAL_ACL_POST_OP_ARG = 2048, EXPERIMENTAL_ACL_POST_OP_ARG_FIRST = EXPERIMENTAL_ACL_POST_OP_ARG,
  EXPERIMENTAL_ACL_POST_OP_ARG_LAST = EXPERIMENTAL_ACL_POST_OP_ARG_FIRST + 1024
}
 Memory type. More...
 
enum  GPUTarget {
  UNKNOWN = 0x101, GPU_ARCH_MASK = 0xF00, GPU_GENERATION_MASK = 0x0F0, MIDGARD = 0x100,
  BIFROST = 0x200, VALHALL = 0x300, T600 = 0x110, T700 = 0x120,
  T800 = 0x130, G71 = 0x210, G72 = 0x220, G51 = 0x221,
  G51BIG = 0x222, G51LIT = 0x223, G31 = 0x224, G76 = 0x230,
  G52 = 0x231, G52LIT = 0x232, G77 = 0x310, G57 = 0x311,
  G78 = 0x320, G68 = 0x321, G78AE = 0x330, G710 = 0x340,
  G610 = 0x341, G510 = 0x342, G310 = 0x343, G715 = 0x350,
  G615 = 0x351
}
 Available GPU Targets. More...
 
enum  DeviceType { NEON, CL }
 Device types. More...
 
enum  RoundingPolicy { TO_ZERO, TO_NEAREST_UP, TO_NEAREST_EVEN }
 Rounding method. More...
 
enum  Format {
  UNKNOWN, U8, S16, U16,
  S32, U32, BFLOAT16, F16,
  F32, UV88, RGB888, RGBA8888,
  YUV444, YUYV422, NV12, NV21,
  IYUV, UYVY422
}
 Image colour formats. More...
 
enum  DataType {
  UNKNOWN, U8, S8, QSYMM8,
  QASYMM8, QASYMM8_SIGNED, QSYMM8_PER_CHANNEL, U16,
  S16, QSYMM16, QASYMM16, U32,
  S32, U64, S64, BFLOAT16,
  F16, F32, F64, SIZET
}
 Available data types. More...
 
enum  SamplingPolicy { CENTER, TOP_LEFT }
 Available Sampling Policies. More...
 
enum  DataLayout {
  UNKNOWN, NCHW, NHWC, NCDHW,
  NDHWC
}
 [DataLayout enum definition] More...
 
enum  DataLayoutDimension {
  CHANNEL, HEIGHT, WIDTH, DEPTH,
  BATCHES
}
 [DataLayout enum definition] More...
 
enum  ConvolutionMethod {
  GEMM, GEMM_CONV2D, DIRECT, WINOGRAD,
  FFT
}
 Available ConvolutionMethod. More...
 
enum  DepthwiseConvolutionFunction { OPTIMIZED, GENERIC }
 Available DepthwiseConvolutionFunction. More...
 
enum  DeconvolutionMethod { GEMM, DIRECT }
 Available DeconvolutionMethod. More...
 
enum  FuseBatchNormalizationType { CONVOLUTION, DEPTHWISECONVOLUTION }
 Available FuseBatchNormalizationType. More...
 
enum  PaddingMode { CONSTANT, REFLECT, SYMMETRIC }
 Padding mode to use for PadLayer. More...
 
enum  ComparisonOperation {
  Equal, NotEqual, Greater, GreaterEqual,
  Less, LessEqual
}
 Supported comparison operations. More...
 
enum  BorderMode { UNDEFINED, CONSTANT, REPLICATE }
 Methods available to handle borders. More...
 
enum  ConvertPolicy { WRAP, SATURATE }
 Policy to handle integer overflow. More...
 
enum  InterpolationPolicy { NEAREST_NEIGHBOR, BILINEAR, AREA }
 Interpolation method. More...
 
enum  BilinearInterpolation { BILINEAR_OLD_NEW, BILINEAR_SCHARR }
 Bilinear Interpolation method used by LKTracker. More...
 
enum  Channel {
  UNKNOWN, C0, C1, C2,
  C3, R, G, B,
  A, Y, U, V
}
 Available channels. More...
 
enum  ReductionOperation {
  ARG_IDX_MAX, ARG_IDX_MIN, MEAN_SUM, PROD,
  SUM_SQUARE, SUM, MIN, MAX
}
 Available reduction operations. More...
 
enum  ArithmeticOperation {
  ADD, SUB, DIV, MIN,
  MAX, SQUARED_DIFF, POWER, PRELU
}
 Available element-wise operations. More...
 
enum  ElementWiseUnary {
  RSQRT, EXP, NEG, LOG,
  ABS, SIN, ROUND, LOGICAL_NOT
}
 Available element wise unary operations. More...
 
enum  BitwiseOperation { AND, NOT, OR, XOR }
 Available bitwise operations. More...
 
enum  NormType { IN_MAP_1D, IN_MAP_2D, CROSS_MAP }
 The normalization type used for the normalization layer. More...
 
enum  DimensionRoundingType { FLOOR, CEIL }
 Dimension rounding type when down-scaling on CNNs. More...
 
enum  PoolingType { MAX, AVG, L2 }
 Available pooling types. More...
 
enum  NMSType { LINEAR, GAUSSIAN, ORIGINAL }
 Available non maxima suppression types. More...
 
enum  DetectionOutputLayerCodeType { CORNER, CENTER_SIZE, CORNER_SIZE, TF_CENTER }
 Available Detection Output code types. More...
 
enum  WeightFormat {
  UNSPECIFIED = 0x1, ANY = 0x2, OHWI = 0x100100, OHWIo2 = 0x100200,
  OHWIo4 = 0x100400, OHWIo8 = 0x100800, OHWIo16 = 0x101000, OHWIo32 = 0x102000,
  OHWIo64 = 0x104000, OHWIo128 = 0x108000, OHWIo4i2 = 0x200400, OHWIo4i2_bf16 = 0x200410,
  OHWIo8i2 = 0x200800, OHWIo8i2_bf16 = 0x200810, OHWIo16i2 = 0x201000, OHWIo16i2_bf16 = 0x201010,
  OHWIo32i2 = 0x202000, OHWIo32i2_bf16 = 0x202010, OHWIo64i2 = 0x204000, OHWIo64i2_bf16 = 0x204010,
  OHWIo4i4 = 0x400400, OHWIo4i4_bf16 = 0x400410, OHWIo8i4 = 0x400800, OHWIo8i4_bf16 = 0x400810,
  OHWIo16i4 = 0x401000, OHWIo16i4_bf16 = 0x401010, OHWIo32i4 = 0x402000, OHWIo32i4_bf16 = 0x402010,
  OHWIo64i4 = 0x404000, OHWIo64i4_bf16 = 0x404010, OHWIo2i8 = 0x800200, OHWIo4i8 = 0x800400,
  OHWIo8i8 = 0x800800, OHWIo16i8 = 0x801000, OHWIo32i8 = 0x802000, OHWIo64i8 = 0x804000
}
 Memory layouts for the weights tensor. More...
 
enum  GEMMLowpOutputStageType { NONE, QUANTIZE_DOWN, QUANTIZE_DOWN_FIXEDPOINT, QUANTIZE_DOWN_FLOAT }
 GEMMLowp output stage type. More...
 
enum  CLTunerMode { EXHAUSTIVE, NORMAL, RAPID }
 < OpenCL tuner modes More...
 
enum  CLGEMMKernelType { NATIVE, RESHAPED, RESHAPED_ONLY_RHS, RESHAPED_ONLY_RHS_MMUL }
 OpenCL GEMM kernel types. More...
 
enum  CLBackendType { Native, Clvk }
 List the possible OpenCL backends. More...
 
enum  FFTDirection { Forward, Inverse }
 FFT direction to use. More...
 
enum  MappingType { BLOBS, OFFSETS }
 Mapping type. More...
 
enum  StatusCode {
  Success = AclSuccess, RuntimeError = AclRuntimeError, OutOfMemory = AclOutOfMemory, Unimplemented = AclUnimplemented,
  UnsupportedTarget = AclUnsupportedTarget, InvalidTarget = AclInvalidTarget, InvalidArgument = AclInvalidArgument, UnsupportedConfig = AclUnsupportedConfig,
  InvalidObjectState = AclInvalidObjectState
}
 
enum  Target { Cpu = AclTarget::AclCpu, GpuOcl = AclTarget::AclGpuOcl }
 
enum  ExecutionMode { FastRerun = AclPreferFastRerun, FastStart = AclPreferFastStart }
 
enum  ImportMemoryType { HostPtr = AclImportMemoryType::AclHostPtr }
 
enum  LogicalOperation { Unknown, And, Or, Not }
 List of supported logical operations. More...
 

Functions

std::string get_cl_type_from_data_type (const DataType &dt)
 Translates a tensor data type to the appropriate OpenCL type. More...
 
std::string get_cl_promoted_type_from_data_type (const DataType &dt)
 Translates a tensor data type to the appropriate OpenCL promoted type. More...
 
std::string get_cl_unsigned_type_from_element_size (size_t element_size)
 Translates the element size to an unsigned integer data type. More...
 
std::string get_cl_signed_type_from_element_size (size_t element_size)
 Translates the element size to an signed integer data type. More...
 
std::string get_cl_select_type_from_data_type (const DataType &dt)
 Translates a tensor data type to the appropriate OpenCL select type. More...
 
std::string get_cl_dot8_acc_type_from_data_type (const DataType &dt)
 Translates a tensor data type to the appropriate OpenCL dot8 accumulator type. More...
 
std::string get_data_size_from_data_type (const DataType &dt)
 Get the size of a data type in number of bits. More...
 
GPUTarget get_target_from_device (const cl::Device &device)
 Helper function to get the GPU target from CL device. More...
 
CLVersion get_cl_version (const cl::Device &device)
 Helper function to get the highest OpenCL version supported. More...
 
size_t get_cl_image_pitch_alignment (const cl::Device &device)
 Helper function to get the cl_image pitch alignment in pixels. More...
 
bool get_cl_non_uniform_work_group_supported (const cl::Device &device)
 Helper function to check whether non-uniform work group is supported. More...
 
bool device_supports_extension (const cl::Device &device, const char *extension_name)
 Helper function to check whether a given extension is supported. More...
 
bool fp16_supported (const cl::Device &device)
 Helper function to check whether the cl_khr_fp16 extension is supported. More...
 
bool arm_non_uniform_workgroup_supported (const cl::Device &device)
 Helper function to check whether the arm_non_uniform_work_group_size extension is supported. More...
 
bool dot8_supported (const cl::Device &device)
 Helper function to check whether the cl_arm_integer_dot_product_int8 extension is supported. More...
 
bool dot8_acc_supported (const cl::Device &device)
 Helper function to check whether the cl_arm_integer_dot_product_accumulate_int8 extension is supported. More...
 
bool cl_winograd_convolution_layer_supported (const Size2D &output_tile, const Size2D &kernel_size, DataLayout data_layout)
 This function checks if the Winograd configuration (defined through the output tile, kernel size and the data layout) is supported on OpenCL. More...
 
size_t preferred_vector_width (const cl::Device &device, DataType dt)
 Helper function to get the preferred native vector width size for built-in scalar types that can be put into vectors. More...
 
bool preferred_dummy_work_items_support (const cl::Device &device)
 Helper function to check if "dummy work-items" are preferred to have a power of two NDRange In case dummy work-items is enabled, it is OpenCL kernel responsibility to check if the work-item is out-of range or not. More...
 
bool image2d_from_buffer_supported (const cl::Device &device)
 Helper function to check whether the cl_khr_image2d_from_buffer extension is supported. More...
 
cl::Kernel create_kernel (const CLCompileContext &ctx, const std::string &kernel_name, const std::set< std::string > &build_opts=std::set< std::string >())
 Creates an opencl kernel using a compile context. More...
 
cl::NDRange create_lws_hint_parallel_implementations (unsigned int input_dimension, unsigned int vector_size)
 Creates a suitable LWS hint object for parallel implementations. More...
 
bool get_wbsm_support_info (const cl::Device &device)
 
void set_wbsm (cl::Kernel &kernel, cl_int wbsm_hint)
 
bool export_to_cl_image (const ITensorInfo *tensor)
 
void set_unroll_with_pragma (CLBuildOptions &built_opts, std::initializer_list< int > values)
 
bool arm_matrix_multiply_supported (const cl::Device &device)
 Helper function to check whether the cl_arm_matrix_multiply extension is supported. More...
 
bool opencl_is_available ()
 Check if OpenCL is available. More...
 
template<typename T >
bool operator== (const Dimensions< T > &lhs, const Dimensions< T > &rhs)
 Check that given dimensions are equal. More...
 
template<typename T >
bool operator!= (const Dimensions< T > &lhs, const Dimensions< T > &rhs)
 Check that given dimensions are not equal. More...
 
template<typename... T>
void ignore_unused (T &&...)
 Ignores unused arguments. More...
 
Status create_error (ErrorCode error_code, std::string msg)
 Creates an error containing the error message. More...
 
Status create_error_msg (ErrorCode error_code, const char *func, const char *file, int line, const char *msg)
 Creates an error and the error message. More...
 
void throw_error (Status err)
 Throw an std::runtime_error. More...
 
const std::string & string_from_target (GPUTarget target)
 Translates a given gpu device target to string. More...
 
GPUTarget get_target_from_name (const std::string &device_name)
 Helper function to get the GPU target from a device name. More...
 
GPUTarget get_arch_from_target (GPUTarget target)
 Helper function to get the GPU arch. More...
 
template<typename... Args>
bool gpu_target_is_in (GPUTarget target_to_check, GPUTarget target, Args... targets)
 Helper function to check whether a gpu target is equal to the provided targets. More...
 
bool gpu_target_is_in (GPUTarget target_to_check, GPUTarget target)
 Variant of gpu_target_is_in for comparing two targets. More...
 
template<typename L , typename... Ts>
void execute_window_loop (const Window &w, L &&lambda_function, Ts &&... iterators)
 Iterate through the passed window, automatically adjusting the iterators and calling the lambda_functino for each element. More...
 
template<typename T >
void permute (Dimensions< T > &dimensions, const PermutationVector &perm)
 Permutes given Dimensions according to a permutation vector. More...
 
void permute (TensorShape &shape, const PermutationVector &perm)
 Permutes given TensorShape according to a permutation vector. More...
 
ValidRegion calculate_valid_region_scale (const ITensorInfo &src_info, const TensorShape &dst_shape, InterpolationPolicy interpolate_policy, SamplingPolicy sampling_policy, bool border_undefined)
 Helper function to calculate the Valid Region for Scale. More...
 
Coordinates index2coords (const TensorShape &shape, int index)
 Convert a linear index into n-dimensional coordinates. More...
 
int coords2index (const TensorShape &shape, const Coordinates &coord)
 Convert n-dimensional coordinates into a linear index. More...
 
const std::map< DataLayout, std::vector< DataLayoutDimension > > & get_layout_map ()
 Returns a static map used to find an index or dimension based on a data layout. More...
 
size_t get_data_layout_dimension_index (const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
 Get the index of the given dimension. More...
 
DataLayoutDimension get_index_data_layout_dimension (const DataLayout &data_layout, const size_t index)
 Get the DataLayoutDimension of a given index and layout. More...
 
Size2D compute_winograd_convolution_tiles (const Size2D &in_dims, const Size2D &kernel_size, const Size2D &output_tile_size, const PadStrideInfo &conv_info)
 Calculate the number of output tiles required by Winograd Convolution layer. More...
 
template<typename T >
wrap_around (T x, T m)
 Wrap-around a number within the range 0 <= x < m. More...
 
Coordinatesconvert_negative_axis (Coordinates &coords, int max_value)
 Convert negative coordinates to positive in the range [0, num_dims_input]. More...
 
int adjust_down (int required, int available, int step)
 Decrease required in steps of step until it's less than available. More...
 
int adjust_up (int required, int available, int step)
 Increase required in steps of step until it's greater than available. More...
 
bool operator== (const QuantizationInfo &lhs, const QuantizationInfo &rhs)
 Check whether two quantization info are equal. More...
 
bool operator!= (const QuantizationInfo &lhs, const QuantizationInfo &rhs)
 Check whether two quantization info are not equal. More...
 
bool operator== (const UniformQuantizationInfo &lhs, const UniformQuantizationInfo &rhs)
 Check whether two quantization info are equal. More...
 
bool operator!= (const UniformQuantizationInfo &lhs, const UniformQuantizationInfo &rhs)
 Check whether two quantization info are not equal. More...
 
template<typename INFO_TYPE >
uint8_t quantize_qasymm8 (float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
 Quantize a value given an unsigned 8-bit asymmetric quantization scheme. More...
 
template<typename INFO_TYPE >
int8_t quantize_qasymm8_signed (float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
 Quantize a value given a signed 8-bit asymmetric quantization scheme. More...
 
int8_t quantize_qsymm8 (float value, const QuantizationInfo &qinfo)
 Quantize a value given a 8-bit symmetric quantization scheme. More...
 
int8_t quantize_qsymm8_per_channel (float value, const QuantizationInfo &qinfo, size_t channel_id=0)
 Quantize a value given a 8-bit symmetric per channel quantization scheme. More...
 
template<typename INFO_TYPE >
float dequantize_qasymm8 (uint8_t value, const INFO_TYPE &qinfo)
 Dequantize a value given an unsigned 8-bit asymmetric quantization scheme. More...
 
template<typename INFO_TYPE >
float dequantize_qasymm8_signed (int8_t value, const INFO_TYPE &qinfo)
 Dequantize a value given a signed 8-bit asymmetric quantization scheme. More...
 
float dequantize (uint8_t value, float scale, int32_t offset)
 Dequantize a value given an 8-bit asymmetric quantization scheme. More...
 
float dequantize_qsymm8 (int8_t value, const UniformQuantizationInfo &qinfo)
 Dequantize a value given a 8-bit symmetric quantization scheme. More...
 
qasymm8_t qasymm8_hard_swish (qasymm8_t in, const UniformQuantizationInfo &qi_in, const UniformQuantizationInfo &qi_out)
 
qasymm8_signed_t qasymm8_signed_hard_swish (qasymm8_signed_t in, const UniformQuantizationInfo &qi_in, const UniformQuantizationInfo &qi_out)
 
qasymm8_t qasymm8_leaky_relu (qasymm8_t in, const UniformQuantizationInfo &qi_in, const UniformQuantizationInfo &qi_out, float alpha)
 
qasymm8_t qasymm8_logistic (qasymm8_t in, const UniformQuantizationInfo &qi_in, const UniformQuantizationInfo &qi_out)
 
qasymm8_signed_t qasymm8_signed_logistic (qasymm8_signed_t in, const UniformQuantizationInfo &qi_in, const UniformQuantizationInfo &qi_out)
 
float dequantize (int8_t value, float scale)
 Dequantize a value given a 8-bit symmetric quantization scheme. More...
 
float dequantize (int16_t value, float scale)
 Dequantize a value given a 16-bit symmetric quantization scheme. More...
 
float dequantize (uint16_t value, float scale, int32_t offset)
 Dequantize a value given a 16-bit asymmetric quantization scheme. More...
 
int16_t quantize_qsymm16 (float value, const UniformQuantizationInfo &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
 Quantize a value given a 16-bit symmetric quantization scheme. More...
 
float dequantize_qsymm16 (int16_t value, const UniformQuantizationInfo &qinfo)
 Dequantize a value given a 16-bit symmetric quantization scheme. More...
 
int16_t quantize_qsymm16 (float value, const QuantizationInfo &qinfo)
 Quantize a value given a 16-bit symmetric quantization scheme. More...
 
float dequantize_qsymm16 (int16_t value, const QuantizationInfo &qinfo)
 Dequantize a value given a 16-bit symmetric quantization scheme. More...
 
uint16_t quantize_qasymm16 (float value, const UniformQuantizationInfo &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
 Quantize a value given a 16-bit asymmetric quantization scheme. More...
 
float dequantize_qasymm16 (uint16_t value, const UniformQuantizationInfo &qinfo)
 Dequantize a value given a 16-bit asymmetric quantization scheme. More...
 
uint16_t quantize_qasymm16 (float value, const QuantizationInfo &qinfo)
 Quantize a value given a 16-bit asymmetric quantization scheme. More...
 
float dequantize_qasymm16 (uint16_t value, const QuantizationInfo &qinfo)
 Dequantize a value given a 16-bit asymmetric quantization scheme. More...
 
UniformQuantizationInfo compute_requantization_scale_offset (const UniformQuantizationInfo &uqinfo_in, const UniformQuantizationInfo &uqinfo_out)
 
int round (float x, RoundingPolicy rounding_policy)
 Return a rounded value of x. More...
 
bool operator== (const TensorInfo &lhs, const TensorInfo &rhs)
 Check whether two tensor info are equal. More...
 
bool operator== (const ValidRegion &lhs, const ValidRegion &rhs)
 
int interleave_by (const WeightFormat wf)
 
int block_by (const WeightFormat wf)
 
bool is_fixed_format (const WeightFormat &wf)
 
bool is_fixed_format_fast_math (const WeightFormat &wf)
 
template<typename S , typename T >
constexpr auto DIV_CEIL (S val, T m) -> decltype((val+m - 1)/m)
 Calculate the rounded up quotient of val / m. More...
 
template<typename S , typename T >
auto ceil_to_multiple (S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
 Computes the smallest number larger or equal to value that is a multiple of divisor. More...
 
template<typename S , typename T >
auto floor_to_multiple (S value, T divisor) -> decltype((value/divisor) *divisor)
 Computes the largest number smaller or equal to value that is a multiple of divisor. More...
 
std::string read_file (const std::string &filename, bool binary)
 Load an entire file in memory. More...
 
size_t data_size_from_type (DataType data_type)
 The size in bytes of the data type. More...
 
size_t pixel_size_from_format (Format format)
 The size in bytes of the pixel format. More...
 
size_t element_size_from_data_type (DataType dt)
 The size in bytes of the data type. More...
 
DataType data_type_from_format (Format format)
 Return the data type used by a given single-planar pixel format. More...
 
int plane_idx_from_channel (Format format, Channel channel)
 Return the plane index of a given channel given an input format. More...
 
int channel_idx_from_format (Format format, Channel channel)
 Return the channel index of a given channel given an input format. More...
 
size_t num_planes_from_format (Format format)
 Return the number of planes for a given format. More...
 
size_t num_channels_from_format (Format format)
 Return the number of channels for a given single-planar pixel format. More...
 
DataType get_promoted_data_type (DataType dt)
 Return the promoted data type of a given data type. More...
 
std::tuple< PixelValue, PixelValueget_min_max (DataType dt)
 Compute the mininum and maximum values a data type can take. More...
 
bool has_format_horizontal_subsampling (Format format)
 Return true if the given format has horizontal subsampling. More...
 
bool has_format_vertical_subsampling (Format format)
 Return true if the given format has vertical subsampling. More...
 
TensorShape adjust_odd_shape (const TensorShape &shape, Format format)
 Adjust tensor shape size if width or height are odd for a given multi-planar format. More...
 
TensorShape calculate_subsampled_shape (const TensorShape &shape, Format format, Channel channel=Channel::UNKNOWN)
 Calculate subsampled shape for a given format and channel. More...
 
template<typename T >
void permute_strides (Dimensions< T > &dimensions, const PermutationVector &perm)
 Permutes the given dimensions according the permutation vector. More...
 
PadStrideInfo calculate_same_pad (TensorShape input_shape, TensorShape weights_shape, PadStrideInfo conv_info, DataLayout data_layout=DataLayout::NCHW, const Size2D &dilation=Size2D(1u, 1u), const DimensionRoundingType &rounding_type=DimensionRoundingType::FLOOR)
 Calculate padding requirements in case of SAME padding. More...
 
std::pair< unsigned int, unsigned int > deconvolution_output_dimensions (unsigned int in_width, unsigned int in_height, unsigned int kernel_width, unsigned int kernel_height, const PadStrideInfo &pad_stride_info)
 Returns expected width and height of the deconvolution's output tensor. More...
 
std::pair< unsigned int, unsigned int > scaled_dimensions (int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
 Returns expected width and height of output scaled tensor depending on dimensions rounding mode. More...
 
std::pair< int, int > scaled_dimensions_signed (int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info)
 Returns calculated width and height of output scaled tensor depending on dimensions rounding mode. More...
 
std::tuple< int, int, int > scaled_3d_dimensions_signed (int width, int height, int depth, int kernel_width, int kernel_height, int kernel_depth, const Pooling3dLayerInfo &pool3d_info)
 Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding mode. More...
 
bool needs_serialized_reduction (ReductionOperation op, DataType dt, unsigned int axis)
 Check if the given reduction operation should be handled in a serial way. More...
 
QuantizationInfo get_softmax_output_quantization_info (DataType input_type, bool is_log)
 Returns output quantization information for softmax layer. More...
 
std::pair< int32_t, int32_t > get_quantized_activation_min_max (ActivationLayerInfo act_info, DataType data_type, UniformQuantizationInfo oq_info)
 Returns a pair of minimum and maximum values for a quantized activation. More...
 
const std::string & string_from_format (Format format)
 Convert a tensor format into a string. More...
 
const std::string & string_from_channel (Channel channel)
 Convert a channel identity into a string. More...
 
const std::string & string_from_data_layout (DataLayout dl)
 Convert a data layout identity into a string. More...
 
const std::string & string_from_data_type (DataType dt)
 Convert a data type identity into a string. More...
 
const std::string & string_from_activation_func (ActivationLayerInfo::ActivationFunction act)
 Translates a given activation function to a string. More...
 
const std::string & string_from_interpolation_policy (InterpolationPolicy policy)
 Translates a given interpolation policy to a string. More...
 
const std::string & string_from_border_mode (BorderMode border_mode)
 Translates a given border mode policy to a string. More...
 
const std::string & string_from_norm_type (NormType type)
 Translates a given normalization type to a string. More...
 
const std::string & string_from_pooling_type (PoolingType type)
 Translates a given pooling type to a string. More...
 
bool is_pool_region_entirely_outside_input (const PoolingLayerInfo &info)
 Check if the pool region is entirely outside the input tensor. More...
 
bool is_pool_3d_region_entirely_outside_input (const Pooling3dLayerInfo &info)
 Check if the 3d pool region is entirely outside the input tensor. More...
 
bool is_symmetric (const Padding3D &info)
 Check if the 3D padding is symmetric i.e. More...
 
const std::string & string_from_gemmlowp_output_stage (GEMMLowpOutputStageType output_stage)
 Translates a given GEMMLowp output stage to a string. More...
 
std::string string_from_pixel_value (const PixelValue &value, const DataType data_type)
 Convert a PixelValue to a string, represented through the specific data type. More...
 
DataType data_type_from_name (const std::string &name)
 Convert a string to DataType. More...
 
std::unordered_map< const ITensorInfo *, PaddingSizeget_padding_info (std::initializer_list< const ITensorInfo *> infos)
 Stores padding information before configuring a kernel. More...
 
std::unordered_map< const ITensorInfo *, PaddingSizeget_padding_info (std::initializer_list< const ITensor *> tensors)
 Stores padding information before configuring a kernel. More...
 
bool has_padding_changed (const std::unordered_map< const ITensorInfo *, PaddingSize > &padding_map)
 Check if the previously stored padding info has changed after configuring a kernel. More...
 
inline ::std::istream & operator>> (::std::istream &stream, DataType &data_type)
 Input Stream operator for DataType. More...
 
std::string lower_string (const std::string &val)
 Lower a given string. More...
 
std::string upper_string (const std::string &val)
 Raise a given string to upper case. More...
 
bool is_data_type_float (DataType dt)
 Check if a given data type is of floating point type. More...
 
bool is_data_type_quantized (DataType dt)
 Check if a given data type is of quantized type. More...
 
bool is_data_type_quantized_asymmetric (DataType dt)
 Check if a given data type is of asymmetric quantized type. More...
 
bool is_data_type_quantized_asymmetric_signed (DataType dt)
 Check if a given data type is of asymmetric quantized signed type. More...
 
bool is_data_type_quantized_symmetric (DataType dt)
 Check if a given data type is of symmetric quantized type. More...
 
bool is_data_type_quantized_per_channel (DataType dt)
 Check if a given data type is of per channel type. More...
 
std::string float_to_string_with_full_precision (float val)
 Create a string with the float in full precision. More...
 
size_t num_of_elements_in_range (const float start, const float end, const float step)
 Returns the number of elements required to go from start to end with the wanted step. More...
 
template<typename T >
bool check_value_range (T val, DataType dt, QuantizationInfo qinfo=QuantizationInfo())
 Returns true if the value can be represented by the given data type. More...
 
unsigned int adjust_vec_size (unsigned int vec_size, size_t dim0)
 Returns the adjusted vector size in case it is less than the input's first dimension, getting rounded down to its closest valid vector size. More...
 
std::string cpu_impl_dt (const DataType &data_type)
 Returns the suffix string of CPU kernel implementation names based on the given data type. More...
 
template<typename... Ts>
arm_compute::Status error_on_nullptr (const char *function, const char *file, const int line, Ts &&... pointers)
 Create an error if one of the pointers is a nullptr. More...
 
arm_compute::Status error_on_mismatching_windows (const char *function, const char *file, const int line, const Window &full, const Window &win)
 Return an error if the passed window is invalid. More...
 
arm_compute::Status error_on_invalid_subwindow (const char *function, const char *file, const int line, const Window &full, const Window &sub)
 Return an error if the passed subwindow is invalid. More...
 
arm_compute::Status error_on_window_not_collapsable_at_dimension (const char *function, const char *file, const int line, const Window &full, const Window &window, const int dim)
 Return an error if the window can't be collapsed at the given dimension. More...
 
arm_compute::Status error_on_coordinates_dimensions_gte (const char *function, const char *file, const int line, const Coordinates &pos, unsigned int max_dim)
 Return an error if the passed coordinates have too many dimensions. More...
 
arm_compute::Status error_on_window_dimensions_gte (const char *function, const char *file, const int line, const Window &win, unsigned int max_dim)
 Return an error if the passed window has too many dimensions. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_mismatching_dimensions (const char *function, const char *file, int line, const Dimensions< T > &dim1, const Dimensions< T > &dim2, Ts &&... dims)
 Return an error if the passed dimension objects differ. More...
 
template<typename... Ts>
arm_compute::Status error_on_tensors_not_even (const char *function, const char *file, int line, const Format &format, const ITensor *tensor1, Ts... tensors)
 Return an error if the passed tensor objects are not even. More...
 
template<typename... Ts>
arm_compute::Status error_on_tensors_not_subsampled (const char *function, const char *file, int line, const Format &format, const TensorShape &shape, const ITensor *tensor1, Ts... tensors)
 Return an error if the passed tensor objects are not sub-sampled. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_shapes (const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
 Return an error if the passed two tensor infos have different shapes from the given dimension. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_shapes (const char *function, const char *file, const int line, const ITensor *tensor_1, const ITensor *tensor_2, Ts... tensors)
 Return an error if the passed two tensors have different shapes from the given dimension. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_shapes (const char *function, const char *file, const int line, unsigned int upper_dim, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
 Return an error if the passed two tensors have different shapes from the given dimension. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_shapes (const char *function, const char *file, const int line, unsigned int upper_dim, const ITensor *tensor_1, const ITensor *tensor_2, Ts... tensors)
 Return an error if the passed two tensors have different shapes from the given dimension. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_data_layouts (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
 Return an error if the passed tensor infos have different data layouts. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_data_layouts (const char *function, const char *file, const int line, const ITensor *tensor, Ts... tensors)
 Return an error if the passed tensors have different data layouts. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_data_types (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
 Return an error if the passed two tensor infos have different data types. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_data_types (const char *function, const char *file, const int line, const ITensor *tensor, Ts... tensors)
 Return an error if the passed two tensors have different data types. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_quantization_info (const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
 Return an error if the passed tensor infos have different asymmetric quantized data types or different quantization info. More...
 
template<typename... Ts>
arm_compute::Status error_on_mismatching_quantization_info (const char *function, const char *file, const int line, const ITensor *tensor_1, const ITensor *tensor_2, Ts... tensors)
 Return an error if the passed tensor have different asymmetric quantized data types or different quantization info. More...
 
template<typename T , typename F , typename... Fs>
void error_on_format_not_in (const char *function, const char *file, const int line, const T *object, F &&format, Fs &&... formats)
 Throw an error if the format of the passed tensor/multi-image does not match any of the formats provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_type_not_in (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dt, Ts &&... dts)
 Return an error if the data type of the passed tensor info does not match any of the data types provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_type_not_in (const char *function, const char *file, const int line, const ITensor *tensor, T &&dt, Ts &&... dts)
 Return an error if the data type of the passed tensor does not match any of the data types provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_layout_not_in (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dl, Ts &&... dls)
 Return an error if the data layout of the passed tensor info does not match any of the data layouts provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_layout_not_in (const char *function, const char *file, const int line, const ITensor *tensor, T &&dl, Ts &&... dls)
 Return an error if the data layout of the passed tensor does not match any of the data layout provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_type_channel_not_in (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, size_t num_channels, T &&dt, Ts &&... dts)
 Return an error if the data type or the number of channels of the passed tensor info does not match any of the data types and number of channels provided. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_data_type_channel_not_in (const char *function, const char *file, const int line, const ITensor *tensor, size_t num_channels, T &&dt, Ts &&... dts)
 Return an error if the data type or the number of channels of the passed tensor does not match any of the data types and number of channels provided. More...
 
arm_compute::Status error_on_unsupported_fp16 (const char *function, const char *file, const int line, const ITensorInfo *tensor_info, bool is_fp16_supported)
 Return an error if the data type of the passed tensor info is FP16 and FP16 extension is not supported by the device. More...
 
arm_compute::Status error_on_unsupported_fp16 (const char *function, const char *file, const int line, const ITensor *tensor, bool is_fp16_supported)
 Return an error if the data type of the passed tensor is FP16 and FP16 extension is not supported by the device. More...
 
arm_compute::Status error_on_tensor_not_2d (const char *function, const char *file, const int line, const ITensor *tensor)
 Return an error if the tensor is not 2D. More...
 
arm_compute::Status error_on_tensor_not_2d (const char *function, const char *file, const int line, const ITensorInfo *tensor)
 Return an error if the tensor info is not 2D. More...
 
template<typename T , typename... Ts>
arm_compute::Status error_on_channel_not_in (const char *function, const char *file, const int line, T cn, T &&channel, Ts &&... channels)
 Return an error if the channel is not in channels. More...
 
arm_compute::Status error_on_channel_not_in_known_format (const char *function, const char *file, const int line, Format fmt, Channel cn)
 Return an error if the channel is not in format. More...
 
arm_compute::Status error_on_unconfigured_kernel (const char *function, const char *file, const int line, const IKernel *kernel)
 Return an error if the kernel is not configured. More...
 
arm_compute::Status error_on_invalid_subtensor (const char *function, const char *file, const int line, const TensorShape &parent_shape, const Coordinates &coords, const TensorShape &shape)
 Return an error if if the coordinates and shape of the subtensor are within the parent tensor. More...
 
arm_compute::Status error_on_invalid_subtensor_valid_region (const char *function, const char *file, const int line, const ValidRegion &parent_valid_region, const ValidRegion &valid_region)
 Return an error if the valid region of a subtensor is not inside the valid region of the parent tensor. More...
 
std::string build_information ()
 Returns the arm_compute library build information. More...
 
void swap (Window &lhs, Window &rhs)
 
bool operator== (const Window &lhs, const Window &rhs)
 
Coordinates convert_window_coord_to_position (const Window &w, const Coordinates &offset)
 Convert an offset in window steps into absolute coordinates. More...
 
template<typename L >
WindowIterator< L > create_window_iterator (const Window &w, const Coordinates &start, const Coordinates &end, L &&lambda_function)
 Create a WindowIterator object. More...
 
arm_compute::DataLayout data_layout_from_name (const std::string &name)
 Converts a string to a strong types enumeration DataLayout. More...
 
inline ::std::istream & operator>> (::std::istream &stream, arm_compute::DataLayout &data_layout)
 Input Stream operator for DataLayout. More...
 
std::tuple< cl::Context, cl::Device, cl_int > create_opencl_context_and_device (CLBackendType cl_backend_type)
 This function creates an OpenCL context and a device. More...
 
void schedule_kernel_on_ctx (CLRuntimeContext *ctx, ICLKernel *kernel, bool flush=true)
 Schedules a kernel using the context if not nullptr else uses the legacy scheduling flow. More...
 
cl::Platform select_preferable_platform (CLBackendType cl_backend_type)
 This function selects the OpenCL platform based on the backend type. More...
 
CLTunerMode tuner_mode_from_name (const std::string &name)
 Converts a string to a strong types enumeration CLTunerMode. More...
 
inline ::std::istream & operator>> (::std::istream &stream, CLTunerMode &tuner_mode)
 Input Stream operator for CLTunerMode. More...
 
void save_program_cache_to_file (const std::string &filename="cache.bin")
 This function saves opencl kernels library to a file. More...
 
void restore_program_cache_from_file (const std::string &filename="cache.bin")
 This function loads prebuilt opencl kernels from a file. More...
 
IContextget_internal (AclContext ctx)
 Extract internal representation of a Context. More...
 
IOperatorget_internal (AclOperator op)
 Extract internal representation of an Operator. More...
 
IQueueget_internal (AclQueue queue)
 Extract internal representation of a Queue. More...
 
ITensorV2get_internal (AclTensor tensor)
 Extract internal representation of a Tensor. More...
 
TensorPackget_internal (AclTensorPack pack)
 Extract internal representation of a TensoPack. More...
 
cl::Image2D create_image2d_from_buffer (const cl::Context &ctx, const cl::Buffer &buffer, const TensorShape &shape2d, DataType data_type, size_t image_row_pitch)
 Create a cl::Image2D object from an OpenCL buffer. More...
 
arm_compute::Status error_on_unsupported_int64_base_atomics (const char *function, const char *file, const int line)
 Return an error if int64_base_atomics extension is not supported by the device. More...
 
cl::NDRange get_default_lws_for_type (CLKernelType kernel_type, cl::NDRange gws)
 
void enqueue (cl::CommandQueue &queue, ICLKernel &kernel, const Window &window, const cl::NDRange &lws_hint=CLKernelLibrary::get().default_ndrange(), bool use_dummy_work_items=false)
 Add the kernel to the command queue with the given window. More...
 
Status error_on_unsupported_cpu_fp16 (const char *function, const char *file, const int line, const ITensorInfo *tensor_info)
 Return an error if the data type of the passed tensor info is FP16 and FP16 support is not compiled in. More...
 
Status error_on_unsupported_cpu_bf16 (const char *function, const char *file, const int line, const ITensorInfo *tensor_info)
 Return an error if the data type of the passed tensor info is BFLOAT16 and BFLOAT16 support is not compiled in. More...
 
Status error_on_unsupported_cpu_fp16 (const char *function, const char *file, const int line, const ITensor *tensor)
 Return an error if the data type of the passed tensor is FP16 and FP16 support is not compiled in. More...
 
Status error_on_unsupported_cpu_bf16 (const char *function, const char *file, const int line, const ITensor *tensor)
 Return an error if the data type of the passed tensor is BFLOAT16 and BFLOAT16 support is not compiled in. More...
 
bool auto_init_if_empty (ITensorInfo &info, const TensorShape &shape, int num_channels, DataType data_type, QuantizationInfo quantization_info=QuantizationInfo())
 Auto initialize the tensor info (shape, number of channels and data type) if the current assignment is empty. More...
 
bool auto_init_if_empty (ITensorInfo &info_sink, const ITensorInfo &info_source)
 Auto initialize the tensor info using another tensor info. More...
 
bool set_shape_if_empty (ITensorInfo &info, const TensorShape &shape)
 Set the shape to the specified value if the current assignment is empty. More...
 
bool set_format_if_unknown (ITensorInfo &info, Format format)
 Set the format, data type and number of channels to the specified value if the current data type is unknown. More...
 
bool set_data_type_if_unknown (ITensorInfo &info, DataType data_type)
 Set the data type and number of channels to the specified value if the current data type is unknown. More...
 
bool set_data_layout_if_unknown (ITensorInfo &info, DataLayout data_layout)
 Set the data layout to the specified value if the current data layout is unknown. More...
 
bool set_quantization_info_if_empty (ITensorInfo &info, QuantizationInfo quantization_info)
 Set the quantization info to the specified value if the current quantization info is empty and the data type of asymmetric quantized type. More...
 
int offset_int_vec (int offset)
 
template<typename TensorType >
WorkspaceData< TensorTypemanage_workspace (const experimental::MemoryRequirements &mem_reqs, MemoryGroup &mgroup, ITensorPack &run_pack)
 
template<typename TensorType >
WorkspaceData< TensorTypemanage_workspace (const experimental::MemoryRequirements &mem_reqs, MemoryGroup &mgroup, ITensorPack &run_pack, ITensorPack &prep_pack)
 
template<typename TensorType >
void release_prepare_tensors (WorkspaceData< TensorType > &workspace, ITensorPack &prep_pack)
 
template<typename TensorType >
void release_temporaries (const experimental::MemoryRequirements &mem_reqs, WorkspaceData< TensorType > &workspace)
 Utility function to release tensors with lifetime marked as Prepare. More...
 
unsigned int get_normalization_dimension_index (DataLayout layout, const NormalizationLayerInfo &info)
 Calculate the normalization dimension index for a given normalization type. More...
 
template<typename T , typename... Ts>
Strides compute_strides (const ITensorInfo &info, T stride_x, Ts &&... fixed_strides)
 Create a strides object based on the provided strides and the tensor dimensions. More...
 
template<typename... Ts>
Strides compute_strides (const ITensorInfo &info)
 Create a strides object based on the tensor dimensions. More...
 
unsigned int get_next_power_two (unsigned int x)
 Given an integer value, this function returns the next power of two. More...
 
Window calculate_max_window (const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
 
Window calculate_max_window (const TensorShape &shape, const Steps &steps, bool skip_border, BorderSize border_size)
 
Window calculate_max_enlarged_window (const ValidRegion &valid_region, const Steps &steps, BorderSize border_size)
 
Window calculate_max_window_horizontal (const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
 
std::pair< Window, size_t > calculate_squashed_or_max_window (const ITensorInfo &src0, const ITensorInfo &src1)
 
std::pair< Window, size_t > calculate_squashed_or_max_window (const ITensorInfo &src)
 
template<typename... Ts>
bool update_window_and_padding (Window &win, Ts &&... patterns)
 Update window and padding size for each of the access patterns. More...
 
template<typename... Ts>
ValidRegion intersect_valid_regions (const Ts &... regions)
 Intersect multiple valid regions. More...
 
void colorconvert_rgb_to_rgbx (const void *__restrict input, void *__restrict output, const Window &win)
 Convert RGB to RGBX. More...
 
void colorconvert_rgb_to_u8 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert RGB to U8. More...
 
void colorconvert_rgbx_to_rgb (const void *input, void *output, const Window &win)
 Convert RGBX to RGB. More...
 
template<bool yuyv, bool alpha>
void colorconvert_yuyv_to_rgb (const void *__restrict input, void *__restrict output, const Window &win)
 Convert YUYV to RGB. More...
 
template<bool uv, bool alpha>
void colorconvert_nv12_to_rgb (const void *__restrict input, void *__restrict output, const Window &win)
 Convert NV12 to RGB. More...
 
template<bool alpha>
void colorconvert_iyuv_to_rgb (const void *__restrict input, void *__restrict output, const Window &win)
 Convert IYUV to RGB. More...
 
template<bool yuyv>
void colorconvert_yuyv_to_nv12 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert YUYV to NV12. More...
 
void colorconvert_iyuv_to_nv12 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert IYUV to NV12. More...
 
template<bool uv>
void colorconvert_nv12_to_iyuv (const void *__restrict input, void *__restrict output, const Window &win)
 Convert NV12 to IYUV. More...
 
template<bool yuyv>
void colorconvert_yuyv_to_iyuv (const void *__restrict input, void *__restrict output, const Window &win)
 Convert YUYV to IYUV. More...
 
template<bool uv>
void colorconvert_nv12_to_yuv4 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert NV12 to YUV4. More...
 
void colorconvert_iyuv_to_yuv4 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert IYUV to YUV4. More...
 
template<bool alpha>
void colorconvert_rgb_to_nv12 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert RGB to NV12. More...
 
template<bool alpha>
void colorconvert_rgb_to_iyuv (const void *__restrict input, void *__restrict output, const Window &win)
 Convert RGB to IYUV. More...
 
template<bool alpha>
void colorconvert_rgb_to_yuv4 (const void *__restrict input, void *__restrict output, const Window &win)
 Convert RGB to YUV4. More...
 
template<typename T >
void run_reverse (const Window &window, const ITensor *input, const ITensor *axis, ITensor *output)
 
uint8x16_t vmlaq_qasymm8 (qasymm8x16_t vd, float32x4_t vs, float32x4_t vo)
 Perform a multiply-accumulate on all 16 components of a QASYMM8 vector. More...
 
int8x16_t vmlaq_qasymm8_signed (qasymm8x16_signed_t vd, float32x4_t vs, float32x4_t vo)
 Perform a multiply-accumulate on all 16 components of a QASYMM8_SIGNED vector. More...
 
uint8x16_t finalize_quantization (int32x4x4_t &in_s32, int result_fixedpoint_multiplier, int32_t result_shift, int32x4_t result_offset_after_shift_s32, uint8x16_t min_u8, uint8x16_t max_u8, bool is_bounded_relu)
 Performs final quantization step on 16 elements. More...
 
int8x16_t finalize_quantization (int32x4x4_t &in_s32, int result_fixedpoint_multiplier, int32_t result_shift, int32x4_t result_offset_after_shift_s32, int8x16_t min_s8, int8x16_t max_s8, bool is_bounded_relu)
 Performs final quantization step on 16 elements. More...
 
int8x16_t finalize_quantization_symm (int32x4x4_t &in_s32, const int32x4x4_t &result_fixedpoint_multiplier, const int32x4x4_t &result_shift, const int32x4_t &result_offset_after_shift_s32, const int8x16_t &min_s8, const int8x16_t &max_s8, const bool is_bounded_relu)
 Performs final quantization step on 16 elements for symmetric quantization. More...
 
uint8_t finalize_quantization (int32_t in_value, int result_fixedpoint_multiplier, int32_t result_shift, int32_t result_offset_after_shift_s32, uint8_t min_u8, uint8_t max_u8, bool is_bounded_relu)
 Performs final quantization step on single element. More...
 
int8_t finalize_quantization (int32_t in_value, int result_fixedpoint_multiplier, int32_t result_shift, int32_t result_offset_after_shift_s32, int8_t min_s8, int8_t max_s8, bool is_bounded_relu)
 Performs final quantization step on single element. More...
 
float32x4x2_t vdequantize (const uint8x8_t &qv, const UniformQuantizationInfo &qi)
 Dequantize a neon vector holding 8 quantized values. More...
 
float32x4x2_t vdequantize (const int8x8_t &qv, const UniformQuantizationInfo &qi)
 Dequantize a neon vector holding 8 singed quantized values. More...
 
float32x4x4_t vdequantize (const uint8x16_t &qv, const UniformQuantizationInfo &qi)
 Dequantize a neon vector holding 16 quantized values. More...
 
float32x4x4_t vdequantize (const int8x16_t &qv, const UniformQuantizationInfo &qi)
 Dequantize a neon vector holding 16 signed quantized values. More...
 
float32x4x4_t vdequantize (const uint8x16_t &qv, float scale, int32_t offset)
 Dequantize following an asymmetric quantization scheme a neon vector holding 16 quantized values. More...
 
float32x4x4_t vdequantize (const int8x16_t &qv, float scale, int32_t offset)
 Dequantize a vector of 16 values stored as signed asymmetric. More...
 
float32x4x4_t vdequantize (const int8x16_t &qv, const float32x4x4_t vscale)
 Dequantize following symmetric quantization scheme a neon vector holding 16 quantized values. More...
 
float32x4x4_t vdequantize (const int8x16_t &qv, float scale)
 Dequantize following a symmetric quantization scheme a neon vector holding 16 quantized values. More...
 
uint8x8_t vquantize (const float32x4x2_t &qv, const UniformQuantizationInfo &qi)
 Quantize a neon vector holding 8 floating point values. More...
 
int8x8_t vquantize_signed (const float32x4x2_t &qv, const UniformQuantizationInfo &qi)
 Quantize a neon vector holding 8 floating point values. More...
 
int32x4x4_t vquantize_internal (const float32x4x4_t &qv, float scale, int32_t offset)
 
uint8x16_t vquantize (const float32x4x4_t &qv, const UniformQuantizationInfo &qi)
 Quantize a neon vector holding 16 floating point values. More...
 
int8x16_t vquantize_signed (const float32x4x4_t &qv, const UniformQuantizationInfo &qi)
 Signed quantize a neon vector holding 16 floating point values. More...
 
uint16x8x2_t vquantize_qasymm16 (const float32x4x4_t &qv, const UniformQuantizationInfo &qi)
 Quantize to QASYMM16 a neon vector holding 16 floating point values. More...
 
float32x4x2_t vmax2q_f32 (float32x4x2_t a, float32x4x2_t b)
 Compute lane-by-lane maximum between elements of a float vector with 4x2 elements. More...
 
float32x4_t vfloorq_f32 (float32x4_t val)
 Calculate floor of a vector. More...
 
float32x4_t vroundq_rte_f32 (float32x4_t val)
 Calculate round value of a vector to nearest with ties to even. More...
 
float32x2_t vinvsqrt_f32 (float32x2_t x)
 Calculate inverse square root. More...
 
float32x4_t vinvsqrtq_f32 (float32x4_t x)
 Calculate inverse square root. More...
 
float32x2_t vinv_f32 (float32x2_t x)
 Calculate reciprocal. More...
 
float32x4_t vinvq_f32 (float32x4_t x)
 Calculate reciprocal. More...
 
float32x4_t vtaylor_polyq_f32 (float32x4_t x, const std::array< float32x4_t, 8 > &coeffs)
 Perform a 7th degree polynomial approximation using Estrin's method. More...
 
float32x4_t vexpq_f32 (float32x4_t x)
 Calculate exponential. More...
 
float32x4_t verfq_f32 (float32x4_t x)
 Calculate error function. More...
 
float32x4_t vlogq_f32 (float32x4_t x)
 Calculate logarithm. More...
 
float32x4_t vtanhq_f32 (float32x4_t val)
 Calculate hyperbolic tangent. More...
 
float32x4_t vpowq_f32 (float32x4_t val, float32x4_t n)
 Calculate n power of a number. More...
 
int32x4_t rounding_divide_by_pow2 (int32x4_t x, int32x4_t exponent)
 Round to the nearest division by a power-of-two using exponent. More...
 
int32x4_t rounding_divide_by_pow2 (int32x4_t x, int exponent)
 Round to the nearest division by a power-of-two using exponent. More...
 
int32_t rounding_divide_by_pow2 (int32_t x, int exponent)
 Round to the nearest division by a power-of-two using exponent. More...
 
float32x4x4_t convert_uint8x16_to_float32x4x4 (const uint8x16_t &in)
 Converts from uint8x16 to float32x4x4_t. More...
 
float32x4x4_t convert_int8x16_to_float32x4x4 (const int8x16_t &in)
 Converts from int8x16 to float32x4x4_t. More...
 
template<typename T >
float32x4x4_t convert_to_float32x4x4 (const T &in)
 Converts to float32x4x4_t from the specified templated 16 elements vectors. More...
 
void convert_float32x4x3_to_uint8x8x3 (const float32x4x3_t &in1, const float32x4x3_t &in2, uint8x8x3_t &out)
 Converts from two float32x4x3_t to just one uint8x8x3_t. More...
 
void convert_float32x4x4_to_uint8x16 (const float32x4x4_t &in, uint8x16_t &out)
 Converts from two float32x4x4_t to just one uint8x16_t. More...
 
void convert_float32x4x4_to_int8x16 (const float32x4x4_t &in, int8x16_t &out)
 Converts from float32x4x4_t to just one int8x16_t. More...
 
template<typename float_vec_type , typename int_vec_type >
int_vec_type convert_float_to_int (const float_vec_type &in)
 Converts from float vector to integer vector. More...
 
template<typename float_vec_type , typename int_vec_type >
float_vec_type convert_int_to_float (const int_vec_type &in)
 Converts from integer vector to float vector. More...
 
float32x4_t vsinq_f32 (float32x4_t val)
 Calculate sine. More...
 
float32x2_t vsin_f32 (float32x2_t val)
 Calculate sine. More...
 
float vreduce (const float32x4_t &v)
 Reduce a vector to be a scalar by accumulating all lanes in the vector. More...
 
template<>
float32x4x4_t convert_to_float32x4x4 (const uint8x16_t &in)
 
template<>
float32x4x4_t convert_to_float32x4x4 (const int8x16_t &in)
 
template<>
uint8x16_t convert_float_to_int< float32x4x4_t, uint8x16_t > (const float32x4x4_t &in)
 
template<>
float32x4x4_t convert_int_to_float< float32x4x4_t, uint8x16_t > (const uint8x16_t &in)
 
template<>
int8x16_t convert_float_to_int< float32x4x4_t, int8x16_t > (const float32x4x4_t &in)
 
template<>
float32x4x4_t convert_int_to_float< float32x4x4_t, int8x16_t > (const int8x16_t &in)
 
template<bool is_bounded_relu>
int16x8_t finalize_quantization_int16 (int32x4x2_t &in_s32, int result_fixedpoint_multiplier, int32_t result_shift, int16x8_t min_s16, int16x8_t max_s16)
 Performs final quantization step on 8 signed 16-bit elements. More...
 
template<bool is_bounded_relu>
int16_t finalize_quantization_int16 (int32_t in_value, int result_fixedpoint_multiplier, int32_t result_shift, int16_t min_s16, int16_t max_s16)
 Performs final quantization step on single signed 16-bit element. More...
 
float32x4x2_t vdequantize_int16 (const int16x8_t &qv, float scale)
 Dequantize a neon vector holding 8 16-bit quantized values. More...
 
int16x8_t vquantize_int16 (const float32x4x2_t &qv, float scale)
 Quantize a neon vector holding 8 floating point values. More...
 
float32x4x4_t vdequantize (const int16x8x2_t &qv, const UniformQuantizationInfo &qi)
 Dequantize a neon vector holding 16 16-bit quantized values. More...
 
qsymm16x8x2_t vquantize_qsymm16 (const float32x4x4_t &qv, const UniformQuantizationInfo &qi)
 Quantize a neon vector holding 16 floating point values. More...
 
int32x4x2_t multiply_by_quantized_multiplier_2row (int32x4x2_t input, int32_t qmul, int32_t shift)
 Multiply a neon vector using quantized multiplier and shift. More...
 
Status validate (const ITensorInfo *scores_in, const ITensorInfo *boxes_in, const ITensorInfo *batch_splits_in, const ITensorInfo *scores_out, const ITensorInfo *boxes_out, const ITensorInfo *classes, const ITensorInfo *batch_splits_out, const ITensorInfo *keeps, const ITensorInfo *keeps_size, const BoxNMSLimitInfo info)
 
inline ::std::istream & operator>> (::std::istream &is, BorderMode &mode)
 Formatted input of the BorderMode type. More...
 
template<typename T >
std::string to_string_if_not_null (T *arg)
 Formatted output if arg is not null. More...
 
template<typename T >
std::string to_string (const T &val)
 Fallback method: try to use std::to_string: More...
 
template<typename T >
::std::ostream & operator<< (::std::ostream &os, const std::vector< T > &args)
 Formatted output of a vector of objects. More...
 
template<typename T >
std::string to_string (const std::vector< T > &args)
 Formatted output of a vector of objects. More...
 
template<typename T >
inline ::std::ostream & operator<< (::std::ostream &os, const Dimensions< T > &dimensions)
 Formatted output of the Dimensions type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const RoundingPolicy &rounding_policy)
 Formatted output of the RoundingPolicy type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const WeightsInfo &weights_info)
 Formatted output of the WeightsInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ROIPoolingLayerInfo &pool_info)
 Formatted output of the ROIPoolingInfo type. More...
 
std::string to_string (const ROIPoolingLayerInfo &pool_info)
 Formatted output of the ROIPoolingInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMKernelInfo &gemm_info)
 Formatted output of the GEMMKernelInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMLHSMatrixInfo &gemm_info)
 Formatted output of the GEMMLHSMatrixInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMRHSMatrixInfo &gemm_info)
 Formatted output of the GEMMRHSMatrixInfo type. More...
 
std::string to_string (const GEMMRHSMatrixInfo &gemm_info)
 Formatted output of the GEMMRHSMatrixInfo type. More...
 
std::string to_string (const GEMMLHSMatrixInfo &gemm_info)
 Formatted output of the GEMMLHSMatrixInfo type. More...
 
std::string to_string (const GEMMKernelInfo &gemm_info)
 Formatted output of the GEMMKernelInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const BoundingBoxTransformInfo &bbox_info)
 Formatted output of the BoundingBoxTransformInfo type. More...
 
std::string to_string (const BoundingBoxTransformInfo &bbox_info)
 Formatted output of the BoundingBoxTransformInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ComputeAnchorsInfo &anchors_info)
 Formatted output of the ComputeAnchorsInfo type. More...
 
std::string to_string (const ComputeAnchorsInfo &anchors_info)
 Formatted output of the ComputeAnchorsInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GenerateProposalsInfo &proposals_info)
 Formatted output of the GenerateProposalsInfo type. More...
 
std::string to_string (const GenerateProposalsInfo &proposals_info)
 Formatted output of the GenerateProposalsInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const QuantizationInfo &qinfo)
 Formatted output of the QuantizationInfo type. More...
 
std::string to_string (const QuantizationInfo &quantization_info)
 Formatted output of the QuantizationInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ActivationLayerInfo::ActivationFunction &act_function)
 Formatted output of the activation function type. More...
 
std::string to_string (const arm_compute::ActivationLayerInfo &info)
 Formatted output of the activation function info type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ActivationLayerInfo *info)
 Formatted output of the activation function info. More...
 
std::string to_string (const arm_compute::ActivationLayerInfo::ActivationFunction &function)
 Formatted output of the activation function type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const NormType &norm_type)
 Formatted output of the NormType type. More...
 
std::string to_string (const arm_compute::NormalizationLayerInfo &info)
 Formatted output of NormalizationLayerInfo. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const NormalizationLayerInfo &info)
 Formatted output of NormalizationLayerInfo. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PoolingType &pool_type)
 Formatted output of the PoolingType type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PoolingLayerInfo &info)
 Formatted output of PoolingLayerInfo. More...
 
std::string to_string (const RoundingPolicy &rounding_policy)
 Formatted output of RoundingPolicy. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DataLayout &data_layout)
 [Print DataLayout type] More...
 
std::string to_string (const arm_compute::DataLayout &data_layout)
 Formatted output of the DataLayout type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DataLayoutDimension &data_layout_dim)
 [Print DataLayout type] More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DataType &data_type)
 Formatted output of the DataType type. More...
 
std::string to_string (const arm_compute::DataType &data_type)
 Formatted output of the DataType type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Format &format)
 Formatted output of the Format type. More...
 
std::string to_string (const Format &format)
 Formatted output of the Format type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Channel &channel)
 Formatted output of the Channel type. More...
 
std::string to_string (const Channel &channel)
 Formatted output of the Channel type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const BorderMode &mode)
 Formatted output of the BorderMode type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const BorderSize &border)
 Formatted output of the BorderSize type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PaddingList &padding)
 Formatted output of the PaddingList type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Multiples &multiples)
 Formatted output of the Multiples type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const InterpolationPolicy &policy)
 Formatted output of the InterpolationPolicy type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const SamplingPolicy &policy)
 Formatted output of the SamplingPolicy type. More...
 
inline ::std::ostream & operator<< (std::ostream &os, const ITensorInfo *info)
 Formatted output of the ITensorInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const TensorInfo &info)
 Formatted output of the const TensorInfo& type. More...
 
std::string to_string (const TensorInfo &info)
 Formatted output of the const TensorInfo& type. More...
 
std::string to_string (const ITensorInfo &info)
 Formatted output of the const ITensorInfo& type. More...
 
std::string to_string (const ITensorInfo *info)
 Formatted output of the const ITensorInfo* type. More...
 
std::string to_string (ITensorInfo *info)
 Formatted output of the ITensorInfo* type. More...
 
std::string to_string (const ITensor *tensor)
 Formatted output of the ITensorInfo type obtained from const ITensor* type. More...
 
std::string to_string (ITensor *tensor)
 Formatted output of the ITensorInfo type obtained from the ITensor* type. More...
 
std::string to_string (ITensor &tensor)
 Formatted output of the ITensorInfo type obtained from the ITensor& type. More...
 
template<typename T >
std::string to_string (const Dimensions< T > &dimensions)
 Formatted output of the Dimensions type. More...
 
std::string to_string (const Strides &stride)
 Formatted output of the Strides type. More...
 
std::string to_string (const TensorShape &shape)
 Formatted output of the TensorShape type. More...
 
std::string to_string (const Coordinates &coord)
 Formatted output of the Coordinates type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMReshapeInfo &info)
 Formatted output of the GEMMReshapeInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMInfo &info)
 Formatted output of the GEMMInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Window::Dimension &dim)
 Formatted output of the Window::Dimension type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Window &win)
 Formatted output of the Window type. More...
 
std::string to_string (const WeightsInfo &info)
 Formatted output of the WeightsInfo type. More...
 
std::string to_string (const GEMMReshapeInfo &info)
 Formatted output of the GEMMReshapeInfo type. More...
 
std::string to_string (const GEMMInfo &info)
 Formatted output of the GEMMInfo type. More...
 
std::string to_string (const Window::Dimension &dim)
 Formatted output of the Window::Dimension type. More...
 
std::string to_string (const Window &win)
 Formatted output of the Window& type. More...
 
std::string to_string (Window *win)
 Formatted output of the Window* type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Rectangle &rect)
 Formatted output of the Rectangle type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PaddingMode &mode)
 Formatted output of the PaddingMode type. More...
 
std::string to_string (const PaddingMode &mode)
 Formatted output of the PaddingMode type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PadStrideInfo &pad_stride_info)
 Formatted output of the PadStrideInfo type. More...
 
std::string to_string (const PadStrideInfo &pad_stride_info)
 Formatted output of the PadStrideInfo type. More...
 
std::string to_string (const BorderMode &mode)
 Formatted output of the BorderMode type. More...
 
std::string to_string (const BorderSize &border)
 Formatted output of the BorderSize type. More...
 
std::string to_string (const PaddingList &padding)
 Formatted output of the PaddingList type. More...
 
std::string to_string (const Multiples &multiples)
 Formatted output of the Multiples type. More...
 
std::string to_string (const InterpolationPolicy &policy)
 Formatted output of the InterpolationPolicy type. More...
 
std::string to_string (const SamplingPolicy &policy)
 Formatted output of the SamplingPolicy type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ConvertPolicy &policy)
 Formatted output of the ConvertPolicy type. More...
 
std::string to_string (const ConvertPolicy &policy)
 
inline ::std::ostream & operator<< (::std::ostream &os, const ArithmeticOperation &op)
 Formatted output of the ArithmeticOperation type. More...
 
std::string to_string (const ArithmeticOperation &op)
 Formatted output of the Arithmetic Operation. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ReductionOperation &op)
 Formatted output of the Reduction Operations. More...
 
std::string to_string (const ReductionOperation &op)
 Formatted output of the Reduction Operations. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ComparisonOperation &op)
 Formatted output of the Comparison Operations. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ElementWiseUnary &op)
 Formatted output of the Elementwise unary Operations. More...
 
std::string to_string (const ComparisonOperation &op)
 Formatted output of the Comparison Operations. More...
 
std::string to_string (const ElementWiseUnary &op)
 Formatted output of the Elementwise unary Operations. More...
 
std::string to_string (const NormType &type)
 Formatted output of the Norm Type. More...
 
std::string to_string (const PoolingType &type)
 Formatted output of the Pooling Type. More...
 
std::string to_string (const PoolingLayerInfo &info)
 Formatted output of the Pooling Layer Info. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Size3D &size)
 Formatted output of the Size3D type. More...
 
std::string to_string (const Size3D &type)
 Formatted output of the Size3D type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Padding3D &padding3d)
 Formatted output of the Padding3D type. More...
 
std::string to_string (const Padding3D &padding3d)
 Converts a Padding3D to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DimensionRoundingType &rounding_type)
 Formatted output of the DimensionRoundingType type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Pooling3dLayerInfo &info)
 Formatted output of the Pooling 3d Layer Info. More...
 
std::string to_string (const Pooling3dLayerInfo &info)
 Formatted output of the Pooling 3d Layer Info. More...
 
std::string to_string (const PriorBoxLayerInfo &info)
 Formatted output of the PriorBoxLayerInfo. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Size2D &size)
 Formatted output of the Size2D type. More...
 
std::string to_string (const Size2D &type)
 Formatted output of the Size2D type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ConvolutionMethod &conv_method)
 Formatted output of the ConvolutionMethod type. More...
 
std::string to_string (const ConvolutionMethod &conv_method)
 Formatted output of the ConvolutionMethod type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GPUTarget &gpu_target)
 Formatted output of the GPUTarget type. More...
 
std::string to_string (const GPUTarget &gpu_target)
 Formatted output of the GPUTarget type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DetectionWindow &detection_window)
 Formatted output of the DetectionWindow type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DetectionOutputLayerCodeType &detection_code)
 Formatted output of the DetectionOutputLayerCodeType type. More...
 
std::string to_string (const DetectionOutputLayerCodeType &detection_code)
 Formatted output of the DetectionOutputLayerCodeType type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DetectionOutputLayerInfo &detection_info)
 Formatted output of the DetectionOutputLayerInfo type. More...
 
std::string to_string (const DetectionOutputLayerInfo &detection_info)
 Formatted output of the DetectionOutputLayerInfo type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const DetectionPostProcessLayerInfo &detection_info)
 Formatted output of the DetectionPostProcessLayerInfo type. More...
 
std::string to_string (const DetectionPostProcessLayerInfo &detection_info)
 Formatted output of the DetectionPostProcessLayerInfo type. More...
 
std::string to_string (const DetectionWindow &detection_window)
 Formatted output of the DetectionWindow type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PriorBoxLayerInfo &info)
 Formatted output of PriorBoxLayerInfo. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const WinogradInfo &info)
 Formatted output of the WinogradInfo type. More...
 
std::string to_string (const WinogradInfo &type)
 
std::string to_string (const CLTunerMode val)
 Convert a CLTunerMode value to a string. More...
 
std::string to_string (CLGEMMKernelType val)
 Converts a CLGEMMKernelType to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const CLTunerMode &val)
 [Print CLTunerMode type] More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ConvolutionInfo &conv_info)
 Formatted output of the ConvolutionInfo type. More...
 
std::string to_string (const ConvolutionInfo &info)
 Converts a ConvolutionInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const FullyConnectedLayerInfo &layer_info)
 Formatted output of the FullyConnectedLayerInfo type. More...
 
std::string to_string (const FullyConnectedLayerInfo &info)
 Converts a FullyConnectedLayerInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMLowpOutputStageType &gemm_type)
 Formatted output of the GEMMLowpOutputStageType type. More...
 
std::string to_string (const GEMMLowpOutputStageType &gemm_type)
 Converts a GEMMLowpOutputStageType to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const GEMMLowpOutputStageInfo &gemm_info)
 Formatted output of the GEMMLowpOutputStageInfo type. More...
 
std::string to_string (const GEMMLowpOutputStageInfo &gemm_info)
 Converts a GEMMLowpOutputStageInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Conv2dInfo &conv_info)
 Formatted output of the Conv2dInfo type. More...
 
std::string to_string (const Conv2dInfo &conv_info)
 Converts a Conv2dInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const PixelValue &pixel_value)
 Formatted output of the PixelValue type. More...
 
std::string to_string (const PixelValue &pixel_value)
 Converts a PixelValue to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const ScaleKernelInfo &scale_info)
 Formatted output of the ScaleKernelInfo type. More...
 
std::string to_string (const ScaleKernelInfo &scale_info)
 Converts a ScaleKernelInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const FFTDirection &fft_dir)
 Formatted output of the FFTDirection type. More...
 
std::string to_string (const FFTDirection &fft_dir)
 Converts a FFT1DInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const FFT1DInfo &fft1d_info)
 Formatted output of the FFT1DInfo type. More...
 
std::string to_string (const FFT1DInfo &fft1d_info)
 Converts a FFT1DInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const FFT2DInfo &fft2d_info)
 Formatted output of the FFT2DInfo type. More...
 
std::string to_string (const FFT2DInfo &fft2d_info)
 Converts a FFT2DInfo to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Coordinates2D &coord_2d)
 Formatted output of the Coordinates2D type. More...
 
std::string to_string (const Coordinates2D &coord_2d)
 Converts a Coordinates2D to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const FuseBatchNormalizationType &fuse_type)
 Formatted output of the FuseBatchNormalizationType type. More...
 
std::string to_string (const FuseBatchNormalizationType &fuse_type)
 Converts a FuseBatchNormalizationType to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const SoftmaxKernelInfo &info)
 Formatted output of the SoftmaxKernelInfo type. More...
 
std::string to_string (const SoftmaxKernelInfo &info)
 Converts a SoftmaxKernelInfo to string. More...
 
template<typename T >
::std::ostream & operator<< (::std::ostream &os, const LSTMParams< T > &lstm_params)
 Formatted output of the ScaleKernelInfo type. More...
 
template<typename T >
std::string to_string (const LSTMParams< T > &lstm_params)
 Converts a LSTMParams to string. More...
 
std::string to_string (const uint8_t num)
 Converts a LSTMParams to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const NMSType &nms_type)
 Available non maxima suppression types. More...
 
std::string to_string (const NMSType nms_type)
 Converts a NMSType to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const BoxNMSLimitInfo &info)
 Formatted output of the BoxNMSLimitInfo type. More...
 
std::string to_string (const BoxNMSLimitInfo &info)
 Converts a BoxNMSLimitInfo to string. More...
 
std::string to_string (const DimensionRoundingType &rounding_type)
 Converts a DimensionRoundingType to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Conv3dInfo &conv3d_info)
 Formatted output of the Conv3dInfo type. More...
 
std::string to_string (const Conv3dInfo &conv3d_info)
 Formatted output of the Conv3dInfo type. More...
 
std::string to_string (const WeightFormat wf)
 Formatted output of the arm_compute::WeightFormat type. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const arm_compute::WeightFormat &wf)
 Formatted output of the arm_compute::WeightFormat type. More...
 
std::string to_string (const std::tuple< TensorShape, TensorShape, arm_compute::WeightFormat > values)
 Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const Padding2D &padding2d)
 Formatted output of the Padding2D type. More...
 
std::string to_string (const Padding2D &padding2d)
 Converts a Padding2D to string. More...
 
inline ::std::ostream & operator<< (::std::ostream &os, const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
 Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type. More...
 
std::string to_string (const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
 Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type. More...
 
(EXPERIMENTAL_POST_OPS)
inline ::std::ostream & operator<< (::std::ostream &os, experimental::PostOpType post_op_type)
 Formmated output of the experimental::PostOpType type. More...
 
std::string to_string (experimental::PostOpType post_op_type)
 Converts a experimental::PostOpType to string. More...
 
template<typename T >
inline ::std::ostream & operator<< (::std::ostream &os, const experimental::IPostOp< T > &post_op)
 Formatted output of the experimental::IPostOp type. More...
 
template<typename T >
std::string to_string (const experimental::IPostOp< T > &post_op)
 Converts an experimental::IPostOp to string. More...
 
template<typename T >
inline ::std::ostream & operator<< (::std::ostream &os, const experimental::PostOpList< T > &post_ops)
 Formatted output of the experimental::PostOpList type. More...
 
template<typename T >
std::string to_string (const experimental::PostOpList< T > &post_ops)
 Converts a experimental::PostOpList to string. More...
 

Variables

constexpr size_t MAX_DIMS = 6
 Constant value used to indicate maximum dimensions of a Window, TensorShape and Coordinates. More...
 
const std::array< float32x4_t, 8 > exp_tab
 Exponent polynomial coefficients. More...
 
const std::array< float32x4_t, 8 > log_tab
 Logarithm polynomial coefficients. More...
 
constexpr float te_sin_coeff2 = 0.166666666666f
 Sin polynomial coefficients. More...
 
constexpr float te_sin_coeff3 = 0.05f
 
constexpr float te_sin_coeff4 = 0.023809523810f
 
constexpr float te_sin_coeff5 = 0.013888888889f
 

Detailed Description

Copyright (c) 2017-2022 Arm Limited.

A DotMLGO file parser (LL(k) parser)

[CLReshapeLayer snippet]

[ClReshapeKernel Kernel]

[NEReshapeLayerKernel Kernel]

(EXPERIMENTAL_POST_OPS)

This file contains all available output stages for GEMMLowp.

This file contains all available output stages for GEMMLowp on OpenCL.

Copyright (c) 2018-2022 Arm Limited.

Copyright (c) 2019-2022 Arm Limited.

Copyright (c) 2021-2022 Arm Limited.

Copyright (c) 2021 Arm Limited.

Copyright (c) 2017-2021 Arm Limited.

SPDX-License-Identifier: MIT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

In gemmlowp, the "output stage" is the process that takes a final int32 accumulator value (the output of CLGEMMLowpMatrixMultiplyCore), and processes it to obtain the final QASYMM8/QASYMM8_SIGNED value.

More information about the GEMMLowp output stage can be found at https://github.com/google/gemmlowp/blob/master/doc/output.md

In gemmlowp, the "output stage" is the process that takes a final int32 accumulator value (the output of NEGEMMLowpMatrixMultiplyCore), and processes it to obtain the final ASYMM8 value.

More information about the GEMMLowp output stage can be found at https://github.com/google/gemmlowp/blob/master/doc/output.md

The grammar of DotMLGO is defined as the following ENBF:

delim = "," | "\n"; // Note that delimiters are omitted from the definition below

mlgo = header, heuristics-table, {heuristic-tree};

header = "<header>", gemm-version, ip-type, "</header>"; gemm-version = "gemm-version", "[", int, int, int, "]"; ip-type = "ip-type", ("gpu" | "cpu");

heiristics-table = "<heuristics-table>", {heuristics-table-entry}, "</heuristics-table>"; heuristics-table-entry = entry-id, ip-name, num-cores, data-type, gpu-priority, gpu-behavior, heuristic-type, free-vars; entry-id = int; ip-name = char-sequence; num-cores = int; data-type = "f32" | "f16" | "qasymm8"; gpu-priority = "best-performance" | "best-memory-usage"; gpu-behavior = "static" | "dynamic"; heuristic-type = "gemm-type" | "gemm-config-native" | "gemm-config-reshaped-only-rhs" | "gemm-config-reshaped"; free-vars = "[", {char-sequence}, "]";

heuristic-tree = "<heuristic", entry-id, ">", {tree-node}, "</heuristic>"; tree-node = branch-node | leaf-node; branch-node = "b", entry-id, lhs-type, lhs-value, conditional-op, rhs-type, rhs-value, true-node, false-node; lhs-type = comparator-type; lhs-value = comparator-value; rhs-type = comparator-type; rhs-value = comparator-value; comparator-type = "var" | "num" | "enum"; comparator-value = char-sequence | float; conditional-op = "<" | "<=" | "==" | ">=" | ">"; true-node = entry-id; false-node = entry-id; leaf-node = "l", entry-id, heuristic-type, leaf-value; leaf-value = gemm-type | gemm-config-native | gemm-config-reshaped-only-rhs | gemm-config-reshaped gemm-type = "native" | "reshaped-only-rhs" | "reshaped"; gemm-config-native = "[", int, int, int, "]"; gemm-config-reshaped-only-rhs = "[", int, int, int, int, bool, bool, bool, "]"; gemm-config-reshaped = "[", int, int, int, int, int, bool, bool, bool, bool, "]";

Typedef Documentation

◆ BBox

using BBox = std::array<float, 4>

Definition at line 948 of file Types.h.

◆ BiStrides

Bidirectional strides.

Definition at line 53 of file Types.h.

◆ CLEqual

Basic function to run equal comparison.

Definition at line 124 of file CLComparison.h.

◆ CLFloatArray

using CLFloatArray = CLArray<cl_float>

OpenCL Array of floats.

Definition at line 116 of file CLArray.h.

◆ CLGreater

Basic function to run greater comparison.

Definition at line 128 of file CLComparison.h.

◆ CLGreaterEqual

Basic function to run greater-equal comparison.

Definition at line 130 of file CLComparison.h.

◆ CLImage

using CLImage = CLTensor

OpenCL Image.

Definition at line 104 of file CLTensor.h.

◆ CLInt16Array

using CLInt16Array = CLArray<cl_short>

OpenCL Array of int16s.

Definition at line 112 of file CLArray.h.

◆ CLInt32Array

using CLInt32Array = CLArray<cl_int>

OpenCL Array of int32s.

Definition at line 114 of file CLArray.h.

◆ CLLess

Basic function to run less comparison.

Definition at line 132 of file CLComparison.h.

◆ CLLessEqual

Basic function to run less-equal comparison.

Definition at line 134 of file CLComparison.h.

◆ CLLogSoftmaxLayer

Definition at line 112 of file CLSoftmaxLayer.h.

◆ CLNotEqual

Basic function to run not equal comparison.

Definition at line 126 of file CLComparison.h.

◆ CLSoftmaxLayer

Definition at line 111 of file CLSoftmaxLayer.h.

◆ CLUInt16Array

using CLUInt16Array = CLArray<cl_ushort>

OpenCL Array of uint16s.

Definition at line 108 of file CLArray.h.

◆ CLUInt32Array

using CLUInt32Array = CLArray<cl_uint>

OpenCL Array of uint32s.

Definition at line 110 of file CLArray.h.

◆ CLUInt8Array

using CLUInt8Array = CLArray<cl_uchar>

OpenCL Array of uint8s.

Definition at line 106 of file CLArray.h.

◆ FloatArray

using FloatArray = Array<float>

Array of floats.

Definition at line 74 of file Array.h.

◆ GroupMappings

using GroupMappings = std::map<size_t, MemoryMappings>

A map of the groups and memory mappings.

Definition at line 48 of file Types.h.

◆ half

using half = half_float::half

16-bit floating point type

Definition at line 48 of file Types.h.

◆ ICLFloatArray

using ICLFloatArray = ICLArray<cl_float>

Interface for OpenCL Array of floats.

Definition at line 129 of file ICLArray.h.

◆ ICLImage

Definition at line 117 of file ICLTensor.h.

◆ ICLInt16Array

using ICLInt16Array = ICLArray<cl_short>

Interface for OpenCL Array of int16s.

Definition at line 125 of file ICLArray.h.

◆ ICLInt32Array

using ICLInt32Array = ICLArray<cl_int>

Interface for OpenCL Array of int32s.

Definition at line 127 of file ICLArray.h.

◆ ICLUInt16Array

using ICLUInt16Array = ICLArray<cl_ushort>

Interface for OpenCL Array of uint16s.

Definition at line 121 of file ICLArray.h.

◆ ICLUInt32Array

using ICLUInt32Array = ICLArray<cl_uint>

Interface for OpenCL Array of uint32s.

Definition at line 123 of file ICLArray.h.

◆ ICLUInt8Array

using ICLUInt8Array = ICLArray<cl_uchar>

Interface for OpenCL Array of uint8s.

Definition at line 119 of file ICLArray.h.

◆ IFloatArray

using IFloatArray = IArray<float>

Interface for Array of floats.

Definition at line 144 of file IArray.h.

◆ IImage

using IImage = ITensor

Definition at line 100 of file ITensor.h.

◆ IInt16Array

using IInt16Array = IArray<int16_t>

Interface for Array of int16s.

Definition at line 140 of file IArray.h.

◆ IInt32Array

using IInt32Array = IArray<int32_t>

Interface for Array of int32s.

Definition at line 142 of file IArray.h.

◆ Image

using Image = Tensor

Image.

Definition at line 69 of file Tensor.h.

◆ INEKernel

Common interface for all kernels implemented in Neon.

Definition at line 39 of file INEOperator.h.

◆ Int16Array

using Int16Array = Array<int16_t>

Array of int16s.

Definition at line 70 of file Array.h.

◆ Int32Array

using Int32Array = Array<int32_t>

Array of int32s.

Definition at line 72 of file Array.h.

◆ IUInt16Array

using IUInt16Array = IArray<uint16_t>

Interface for Array of uint16s.

Definition at line 136 of file IArray.h.

◆ IUInt32Array

using IUInt32Array = IArray<uint32_t>

Interface for Array of uint32s.

Definition at line 138 of file IArray.h.

◆ IUInt8Array

using IUInt8Array = IArray<uint8_t>

Interface for Array of uint8s.

Definition at line 134 of file IArray.h.

◆ LabelBBox

using LabelBBox = std::map<int, std::vector<BBox> >

Definition at line 950 of file Types.h.

◆ lock_guard

using lock_guard = std::lock_guard<Mutex>

Wrapper of lock_guard data-object.

Definition at line 37 of file Mutex.h.

◆ MemoryMappings

using MemoryMappings = std::map<IMemory *, size_t>

A map of (handle, index/offset), where handle is the memory handle of the object to provide the memory for and index/offset is the buffer/offset from the pool that should be used.

Note
All objects are pre-pinned to specific buffers to avoid any relevant overheads

Definition at line 45 of file Types.h.

◆ MemoryRequirements

◆ Multiples

using Multiples = std::vector<uint32_t>

Information to produce a tiled version of a Tensor.

Definition at line 456 of file Types.h.

◆ Mutex

using Mutex = std::mutex

Wrapper of Mutex data-object.

Definition at line 33 of file Mutex.h.

◆ NEAbsLayer

◆ NEEqual

Basic function to run equal comparison.

Definition at line 436 of file NEElementwiseOperations.h.

◆ NEExpLayer

◆ NEGreater

Basic function to run greater comparison.

Definition at line 440 of file NEElementwiseOperations.h.

◆ NEGreaterEqual

Basic function to run greater-equal comparison.

Definition at line 442 of file NEElementwiseOperations.h.

◆ NELess

Basic function to run less comparison.

Definition at line 444 of file NEElementwiseOperations.h.

◆ NELessEqual

Basic function to run less-equal comparison.

Definition at line 446 of file NEElementwiseOperations.h.

◆ NELogLayer

◆ NELogSoftmaxLayer

Definition at line 98 of file NESoftmaxLayer.h.

◆ NENegLayer

◆ NENotEqual

Basic function to run not equal comparison.

Definition at line 438 of file NEElementwiseOperations.h.

◆ NERoundLayer

◆ NERsqrtLayer

◆ NEScheduler

CPU Scheduler.

Definition at line 32 of file NEScheduler.h.

◆ NESinLayer

◆ NESoftmaxLayer

Definition at line 97 of file NESoftmaxLayer.h.

◆ OperatorType

Definition at line 39 of file CLGEMM.cpp.

◆ PaddingInfo

using PaddingInfo = std::pair<uint32_t, uint32_t>

Padding information as a pair of unsigned int start/end.

Definition at line 450 of file Types.h.

◆ PaddingList

using PaddingList = std::vector<PaddingInfo>

List of padding information.

Definition at line 453 of file Types.h.

◆ PaddingSize

Container for 2D padding size.

Definition at line 397 of file Types.h.

◆ PermutationVector

Permutation vector.

Definition at line 51 of file Types.h.

◆ qasymm16_t

using qasymm16_t = uint16_t

16 bit quantized asymmetric scalar value

Definition at line 41 of file QuantizationInfo.h.

◆ qasymm8_signed_t

using qasymm8_signed_t = int8_t

8 bit signed quantized asymmetric scalar value

Definition at line 38 of file QuantizationInfo.h.

◆ qasymm8_t

using qasymm8_t = uint8_t

8 bit quantized asymmetric scalar value

Definition at line 39 of file QuantizationInfo.h.

◆ qasymm8x16_signed_t

using qasymm8x16_signed_t = int8x16_t

8 bit quantized signed asymmetric vector with 16 elements

Definition at line 43 of file NEAsymm.h.

◆ qasymm8x16_t

using qasymm8x16_t = uint8x16_t

8 bit quantized asymmetric vector with 16 elements

Definition at line 37 of file NEAsymm.h.

◆ qasymm8x8_signed_t

using qasymm8x8_signed_t = int8x8_t

8 bit quantized signed asymmetric vector with 8 elements

Definition at line 39 of file NEAsymm.h.

◆ qasymm8x8_t

using qasymm8x8_t = uint8x8_t

8 bit quantized asymmetric vector with 8 elements

Definition at line 33 of file NEAsymm.h.

◆ qasymm8x8x2_signed_t

using qasymm8x8x2_signed_t = int8x8x2_t

8 bit quantized signed asymmetric vector with 16 elements

Definition at line 40 of file NEAsymm.h.

◆ qasymm8x8x2_t

using qasymm8x8x2_t = uint8x8x2_t

8 bit quantized asymmetric vector with 16 elements

Definition at line 34 of file NEAsymm.h.

◆ qasymm8x8x3_signed_t

using qasymm8x8x3_signed_t = int8x8x3_t

8 bit quantized signed asymmetric vector with 24 elements

Definition at line 41 of file NEAsymm.h.

◆ qasymm8x8x3_t

using qasymm8x8x3_t = uint8x8x3_t

8 bit quantized asymmetric vector with 24 elements

Definition at line 35 of file NEAsymm.h.

◆ qasymm8x8x4_signed_t

using qasymm8x8x4_signed_t = int8x8x4_t

8 bit quantized signed asymmetric vector with 32 elements

Definition at line 42 of file NEAsymm.h.

◆ qasymm8x8x4_t

using qasymm8x8x4_t = uint8x8x4_t

8 bit quantized asymmetric vector with 32 elements

Definition at line 36 of file NEAsymm.h.

◆ qsymm16_t

typedef int16_t qsymm16_t

16 bit quantized symmetric scalar value

Definition at line 40 of file QuantizationInfo.h.

◆ qsymm16x8_t

using qsymm16x8_t = int16x8_t

16 bit quantized symmetric vector with 8 elements

Definition at line 36 of file NESymm.h.

◆ qsymm16x8x2_t

using qsymm16x8x2_t = int16x8x2_t

16 bit quantized symmetric vector with 16 elements

Definition at line 37 of file NESymm.h.

◆ qsymm8_t

using qsymm8_t = int8_t

8 bit quantized symmetric scalar value

Definition at line 33 of file NESymm.h.

◆ UInt16Array

using UInt16Array = Array<uint16_t>

Array of uint16s.

Definition at line 66 of file Array.h.

◆ UInt32Array

using UInt32Array = Array<uint32_t>

Array of uint32s.

Definition at line 68 of file Array.h.

◆ UInt8Array

using UInt8Array = Array<uint8_t>

Array of uint8s.

Definition at line 64 of file Array.h.

◆ unique_lock

using unique_lock = std::unique_lock<Mutex>

Wrapper of lock_guard data-object.

Definition at line 41 of file Mutex.h.

◆ WorkspaceData

Definition at line 52 of file MemoryHelpers.h.

Enumeration Type Documentation

◆ ArithmeticOperation

enum ArithmeticOperation
strong

Available element-wise operations.

Enumerator
ADD 

(x + y)

SUB 

(x - y)

DIV 

(x / y)

MIN 

Min(x, y)

MAX 

Max(x, y)

SQUARED_DIFF 

(x - y)^2

POWER 

x ^ y

PRELU 

y*x if x < 0, x otherwise

Definition at line 489 of file Types.h.

490 {
491  ADD, /**< (x + y) */
492  SUB, /**< (x - y) */
493  DIV, /**< (x / y) */
494  MIN, /**< Min(x, y) */
495  MAX, /**< Max(x, y) */
496  SQUARED_DIFF, /**< (x - y)^2 */
497  POWER, /**< x ^ y */
498  PRELU, /**< y*x if x < 0, x otherwise */
499 };
#define PRELU(x, y)
#define DIV(x, y)
#define MAX(x, y)
#define MIN(x, y)
#define SUB(x, y)
#define ADD(x, y)
#define SQUARED_DIFF(x, y)

◆ BilinearInterpolation

enum BilinearInterpolation
strong

Bilinear Interpolation method used by LKTracker.

Enumerator
BILINEAR_OLD_NEW 

Old-new method.

BILINEAR_SCHARR 

Scharr method.

Definition at line 419 of file Types.h.

420 {
421  BILINEAR_OLD_NEW, /**< Old-new method */
422  BILINEAR_SCHARR /**< Scharr method */
423 };

◆ BitwiseOperation

enum BitwiseOperation
strong

Available bitwise operations.

Enumerator
AND 

Bitwise AND operation.

NOT 

Bitwise NOT operation.

OR 

Bitwise OR operation.

XOR 

Bitwise XOR operation.

Definition at line 515 of file Types.h.

516 {
517  AND, /**< Bitwise AND operation */
518  NOT, /**< Bitwise NOT operation */
519  OR, /**< Bitwise OR operation */
520  XOR, /**< Bitwise XOR operation */
521 };
Bitwise NOT operation.
Bitwise XOR operation.
Bitwise AND operation.
Bitwise OR operation.

◆ BorderMode

enum BorderMode
strong

Methods available to handle borders.

Enumerator
UNDEFINED 

Borders are left undefined.

CONSTANT 

Pixels outside the image are assumed to have a constant value.

REPLICATE 

Pixels outside the image are assumed to have the same value as the closest image pixel.

Definition at line 274 of file Types.h.

275 {
276  UNDEFINED, /**< Borders are left undefined */
277  CONSTANT, /**< Pixels outside the image are assumed to have a constant value */
278  REPLICATE /**< Pixels outside the image are assumed to have the same value as the closest image pixel */
279 };
Borders are left undefined.
Pixels outside the image are assumed to have the same value as the closest image pixel.

◆ Channel

enum Channel
strong

Available channels.

Enumerator
UNKNOWN 
C0 

Unknown channel format.

First channel (used by formats with unknown channel types).

C1 

Second channel (used by formats with unknown channel types).

C2 

Third channel (used by formats with unknown channel types).

C3 

Fourth channel (used by formats with unknown channel types).

Red channel.

Green channel.

Blue channel.

Alpha channel.

Luma channel.

Cb/U channel.

Cr/V/Value channel.

Definition at line 459 of file Types.h.

460 {
461  UNKNOWN, /** Unknown channel format */
462  C0, /**< First channel (used by formats with unknown channel types). */
463  C1, /**< Second channel (used by formats with unknown channel types). */
464  C2, /**< Third channel (used by formats with unknown channel types). */
465  C3, /**< Fourth channel (used by formats with unknown channel types). */
466  R, /**< Red channel. */
467  G, /**< Green channel. */
468  B, /**< Blue channel. */
469  A, /**< Alpha channel. */
470  Y, /**< Luma channel. */
471  U, /**< Cb/U channel. */
472  V /**< Cr/V/Value channel. */
473 };
Second channel (used by formats with unknown channel types).
Unknown CL kernel type.
Definition: CLTypes.h:82
Cr/V/Value channel.
Unknown channel format.
Third channel (used by formats with unknown channel types).
Fourth channel (used by formats with unknown channel types).

◆ CLBackendType

enum CLBackendType
strong

List the possible OpenCL backends.

Enumerator
Native 

OpenCL native backend.

Clvk 

CLVK backend.

Definition at line 55 of file CLTypes.h.

56 {
57  Native, /**< OpenCL native backend */
58  Clvk, /**< CLVK backend */
59 };
OpenCL native backend.

◆ CLGEMMKernelType

enum CLGEMMKernelType
strong

OpenCL GEMM kernel types.

Enumerator
NATIVE 

Native GEMM kernel with configurable block size.

RESHAPED 

Reshaped GEMM kernel where both lhs and rhs matrices are reshaped.

Configurable reshape and block size

RESHAPED_ONLY_RHS 

Reshaped GEMM kernel where only the rhs matrix is reshaped.

Configurable reshape and block size

RESHAPED_ONLY_RHS_MMUL 

Reshaped GEMM kernel where only the rhs matrix is reshaped.

Using MMUL with configurable block size.

Definition at line 31 of file CLTypes.h.

32 {
33  /** Native GEMM kernel with configurable block size.*/
34  NATIVE,
35  /** Reshaped GEMM kernel where both lhs and rhs matrices are reshaped. Configurable reshape and block size */
36  RESHAPED,
37  /** Reshaped GEMM kernel where only the rhs matrix is reshaped. Configurable reshape and block size */
39  /** Reshaped GEMM kernel where only the rhs matrix is reshaped. Using MMUL with configurable block size. */
41 };
Reshaped GEMM kernel where only the rhs matrix is reshaped.
Reshaped GEMM kernel where only the rhs matrix is reshaped.
Reshaped GEMM kernel where both lhs and rhs matrices are reshaped.
Native GEMM kernel with configurable block size.

◆ CLKernelType

Enumerator
UNKNOWN 

Unknown CL kernel type.

UNKNOWN 
DEPTHWISE 

Depthwise CL kernel type.

DIRECT 

Direct Convolution CL kernel type.

ELEMENTWISE 

Elementwise CL kernel type.

GEMM 

GEMM CL kernel type.

POOL 

Pool CL kernel type.

WINOGRAD 

Winograd CL kernel type.

Definition at line 80 of file CLTypes.h.

81 {
82  UNKNOWN, /**< Unknown CL kernel type */
83  DEPTHWISE, /**< Depthwise CL kernel type */
84  DIRECT, /**< Direct Convolution CL kernel type */
85  ELEMENTWISE, /**< Elementwise CL kernel type */
86  GEMM, /**< GEMM CL kernel type */
87  POOL, /**< Pool CL kernel type */
88  WINOGRAD /**< Winograd CL kernel type */
89 };
Unknown CL kernel type.
Definition: CLTypes.h:82
Winograd CL kernel type.
Definition: CLTypes.h:88
Pool CL kernel type.
Definition: CLTypes.h:87
Elementwise CL kernel type.
Definition: CLTypes.h:85
Depthwise CL kernel type.
Definition: CLTypes.h:83
GEMM CL kernel type.
Definition: CLTypes.h:86
Direct Convolution CL kernel type.
Definition: CLTypes.h:84

◆ CLTunerMode

enum CLTunerMode
strong

< OpenCL tuner modes

Enumerator
EXHAUSTIVE 

Searches all possible LWS configurations while tuning.

NORMAL 

Searches a subset of LWS configurations while tuning.

RAPID 

Searches a minimal subset of LWS configurations while tuning.

Definition at line 35 of file CLTunerTypes.h.

36 {
37  EXHAUSTIVE, /**< Searches all possible LWS configurations while tuning */
38  NORMAL, /**< Searches a subset of LWS configurations while tuning */
39  RAPID /**< Searches a minimal subset of LWS configurations while tuning */
40 };
Searches a subset of LWS configurations while tuning.
Searches a minimal subset of LWS configurations while tuning.
Searches all possible LWS configurations while tuning.

◆ CLVersion

enum CLVersion
strong

Available OpenCL Version.

Enumerator
CL10 
CL11 
CL12 
CL20 
CL30 
UNKNOWN 

Definition at line 39 of file CLTypes.h.

40 {
41  CL10, /* the OpenCL 1.0 */
42  CL11, /* the OpenCL 1.1 */
43  CL12, /* the OpenCL 1.2 */
44  CL20, /* the OpenCL 2.x */
45  CL30, /* the OpenCL 3.x */
46  UNKNOWN /* unkown version */
47 };
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ ComparisonOperation

enum ComparisonOperation
strong

Supported comparison operations.

Enumerator
Equal 

Equal comparison ( \( x == y \) )

NotEqual 

NotEqual comparison ( \( x != y \) )

Greater 

Greater comparison ( \( x > y \) )

GreaterEqual 

Greater equal comparison ( \( x >= y \) )

Less 

Less comparison ( \( x < y \) )

LessEqual 

Less equal comparison ( \( x <= y \) )

Definition at line 173 of file Types.h.

174 {
175  Equal, /**< Equal comparison ( \f$ x == y \f$ ) */
176  NotEqual, /**< NotEqual comparison ( \f$ x != y \f$ ) */
177  Greater, /**< Greater comparison ( \f$ x > y \f$ ) */
178  GreaterEqual, /**< Greater equal comparison ( \f$ x >= y \f$ ) */
179  Less, /**< Less comparison ( \f$ x < y \f$ ) */
180  LessEqual /**< Less equal comparison ( \f$ x <= y \f$ ) */
181 };

◆ ConvertPolicy

enum ConvertPolicy
strong

Policy to handle integer overflow.

Note
: This is ignored by floating point operations where the overflow behavior adheres to the IEEE-754 standard which states that in case of overflow ±infinity is returned for the round-to-nearest modes (and follows the rounding rules for the directed rounding modes) by default.
Enumerator
WRAP 

Wrap around.

SATURATE 

Saturate.

Definition at line 404 of file Types.h.

405 {
406  WRAP, /**< Wrap around */
407  SATURATE /**< Saturate */
408 };

◆ ConvolutionMethod

enum ConvolutionMethod
strong

Available ConvolutionMethod.

Enumerator
GEMM 

Convolution using GEMM.

GEMM_CONV2D 

Direct 2D GEMM convolution.

DIRECT 

Direct convolution.

WINOGRAD 

Convolution using Winograd.

FFT 

Convolution using FFT.

Definition at line 134 of file Types.h.

135 {
136  GEMM, /**< Convolution using GEMM */
137  GEMM_CONV2D, /**< Direct 2D GEMM convolution */
138  DIRECT, /**< Direct convolution */
139  WINOGRAD, /**< Convolution using Winograd */
140  FFT /**< Convolution using FFT */
141 };
Winograd CL kernel type.
Definition: CLTypes.h:88
GEMM CL kernel type.
Definition: CLTypes.h:86
Direct Convolution CL kernel type.
Definition: CLTypes.h:84

◆ CPUModel

enum CPUModel
strong

CPU models types.

Note
We only need to detect CPUs we have microarchitecture-specific code for.
Architecture features are detected via HWCAPs.
Enumerator
GENERIC 
GENERIC_FP16 
GENERIC_FP16_DOT 
A53 
A55r0 
A55r1 
A35 
A73 
A76 
A510 
X1 
V1 
A64FX 

Definition at line 58 of file CPPTypes.h.

59 {
60 #define X(model) model,
62 #undef X
63 };
#define ARM_COMPUTE_CPU_MODEL_LIST
Definition: CPPTypes.h:38

◆ DataLayout

enum DataLayout
strong

[DataLayout enum definition]

Supported tensor data layouts

Enumerator
UNKNOWN 

Unknown data layout.

NCHW 

Num samples, channels, height, width.

NHWC 

Num samples, height, width, channels.

NCDHW 

Num samples, channels, depth, height, width.

NDHWC 

Num samples, depth, height, width, channels.

Definition at line 113 of file Types.h.

114 {
115  UNKNOWN, /**< Unknown data layout */
116  NCHW, /**< Num samples, channels, height, width */
117  NHWC, /**< Num samples, height, width, channels */
118  NCDHW, /**< Num samples, channels, depth, height, width */
119  NDHWC /**< Num samples, depth, height, width, channels */
120 };
Unknown CL kernel type.
Definition: CLTypes.h:82
Num samples, depth, height, width, channels.
Num samples, channels, depth, height, width.
Num samples, channels, height, width.
Num samples, height, width, channels.

◆ DataLayoutDimension

enum DataLayoutDimension
strong

[DataLayout enum definition]

Supported tensor data layout dimensions

Enumerator
CHANNEL 

channel

HEIGHT 

height

WIDTH 

width

DEPTH 

depth

BATCHES 

batches

Definition at line 124 of file Types.h.

125 {
126  CHANNEL, /**< channel */
127  HEIGHT, /**< height */
128  WIDTH, /**< width */
129  DEPTH, /**< depth */
130  BATCHES /**< batches */
131 };

◆ DataType

enum DataType
strong

Available data types.

Enumerator
UNKNOWN 

Unknown data type.

U8 

unsigned 8-bit number

S8 

signed 8-bit number

QSYMM8 

quantized, symmetric fixed-point 8-bit number

QASYMM8 

quantized, asymmetric fixed-point 8-bit number unsigned

QASYMM8_SIGNED 

quantized, asymmetric fixed-point 8-bit number signed

QSYMM8_PER_CHANNEL 

quantized, symmetric per channel fixed-point 8-bit number

U16 

unsigned 16-bit number

S16 

signed 16-bit number

QSYMM16 

quantized, symmetric fixed-point 16-bit number

QASYMM16 

quantized, asymmetric fixed-point 16-bit number

U32 

unsigned 32-bit number

S32 

signed 32-bit number

U64 

unsigned 64-bit number

S64 

signed 64-bit number

BFLOAT16 

16-bit brain floating-point number

F16 

16-bit floating-point number

F32 

32-bit floating-point number

F64 

64-bit floating-point number

SIZET 

size_t

Definition at line 79 of file Types.h.

80 {
81  UNKNOWN, /**< Unknown data type */
82  U8, /**< unsigned 8-bit number */
83  S8, /**< signed 8-bit number */
84  QSYMM8, /**< quantized, symmetric fixed-point 8-bit number */
85  QASYMM8, /**< quantized, asymmetric fixed-point 8-bit number unsigned */
86  QASYMM8_SIGNED, /**< quantized, asymmetric fixed-point 8-bit number signed */
87  QSYMM8_PER_CHANNEL, /**< quantized, symmetric per channel fixed-point 8-bit number */
88  U16, /**< unsigned 16-bit number */
89  S16, /**< signed 16-bit number */
90  QSYMM16, /**< quantized, symmetric fixed-point 16-bit number */
91  QASYMM16, /**< quantized, asymmetric fixed-point 16-bit number */
92  U32, /**< unsigned 32-bit number */
93  S32, /**< signed 32-bit number */
94  U64, /**< unsigned 64-bit number */
95  S64, /**< signed 64-bit number */
96  BFLOAT16, /**< 16-bit brain floating-point number */
97  F16, /**< 16-bit floating-point number */
98  F32, /**< 32-bit floating-point number */
99  F64, /**< 64-bit floating-point number */
100  SIZET /**< size_t */
101 };
quantized, symmetric fixed-point 16-bit number
Unknown CL kernel type.
Definition: CLTypes.h:82
1 channel, 1 U8 per channel
1 channel, 1 F32 per channel
quantized, asymmetric fixed-point 16-bit number
1 channel, 1 U16 per channel
1 channel, 1 F16 per channel
1 channel, 1 S32 per channel
16-bit brain floating-point number
signed 64-bit number
1 channel, 1 U32 per channel
quantized, asymmetric fixed-point 8-bit number unsigned
1 channel, 1 S16 per channel
quantized, symmetric fixed-point 8-bit number
quantized, symmetric per channel fixed-point 8-bit number
quantized, asymmetric fixed-point 8-bit number signed
64-bit floating-point number
unsigned 64-bit number
signed 8-bit number

◆ DeconvolutionMethod

enum DeconvolutionMethod
strong

Available DeconvolutionMethod.

Enumerator
GEMM 

Deconvolution using GEMM.

DIRECT 

Direct deconvolution.

Definition at line 151 of file Types.h.

152 {
153  GEMM, /**< Deconvolution using GEMM */
154  DIRECT, /**< Direct deconvolution */
155 };
GEMM CL kernel type.
Definition: CLTypes.h:86
Direct Convolution CL kernel type.
Definition: CLTypes.h:84

◆ DepthwiseConvolutionFunction

Available DepthwiseConvolutionFunction.

Enumerator
OPTIMIZED 

Optimized Depthwise Convolution.

GENERIC 

Generic Depthwise Convolution.

Definition at line 144 of file Types.h.

145 {
146  OPTIMIZED, /**< Optimized Depthwise Convolution */
147  GENERIC, /**< Generic Depthwise Convolution */
148 };

◆ DetectionOutputLayerCodeType

Available Detection Output code types.

Enumerator
CORNER 

Use box corners.

CENTER_SIZE 

Use box centers and size.

CORNER_SIZE 

Use box centers and size.

TF_CENTER 

Use box centers and size but flip x and y co-ordinates.

Definition at line 953 of file Types.h.

954 {
955  CORNER, /**< Use box corners */
956  CENTER_SIZE, /**< Use box centers and size */
957  CORNER_SIZE, /**< Use box centers and size */
958  TF_CENTER /**< Use box centers and size but flip x and y co-ordinates */
959 };
Use box centers and size but flip x and y co-ordinates.

◆ DeviceType

enum DeviceType
strong

Device types.

Enumerator
NEON 
CL 

Definition at line 33 of file IDevice.h.

◆ DimensionRoundingType

enum DimensionRoundingType
strong

Dimension rounding type when down-scaling on CNNs.

Note
Used in pooling and convolution layer
Enumerator
FLOOR 

Floor rounding.

CEIL 

Ceil rounding.

Definition at line 550 of file Types.h.

551 {
552  FLOOR, /**< Floor rounding */
553  CEIL /**< Ceil rounding */
554 };

◆ ElementWiseUnary

enum ElementWiseUnary
strong

Available element wise unary operations.

Enumerator
RSQRT 

Reverse square root.

EXP 

Exponential.

NEG 

Negate.

LOG 

Natural Logarithm.

ABS 

Absolute value.

SIN 

Sine.

ROUND 

Round.

LOGICAL_NOT 

Logical Not.

Definition at line 502 of file Types.h.

503 {
504  RSQRT, /**< Reverse square root */
505  EXP, /**< Exponential */
506  NEG, /**< Negate */
507  LOG, /**< Natural Logarithm */
508  ABS, /**< Absolute value */
509  SIN, /**< Sine */
510  ROUND, /**< Round */
511  LOGICAL_NOT, /**< Logical Not */
512 };

◆ ErrorCode

enum ErrorCode
strong

Available error codes.

Enumerator
OK 

No error.

RUNTIME_ERROR 

Generic runtime error.

UNSUPPORTED_EXTENSION_USE 

Unsupported extension used.

Definition at line 44 of file Error.h.

45 {
46  OK, /**< No error */
47  RUNTIME_ERROR, /**< Generic runtime error */
48  UNSUPPORTED_EXTENSION_USE /**< Unsupported extension used*/
49 };

◆ ExecutionMode

enum ExecutionMode
strong
Enumerator
FastRerun 
FastStart 

Definition at line 51 of file Types.h.

52 {
55 };
Prioritize performance when a single iterations is expected to be performed.
Definition: AclTypes.h:73
Prefer minimum latency in consecutive runs, might introduce higher startup times. ...
Prefer minimizing startup time.
Prioritize performance when multiple iterations are performed.
Definition: AclTypes.h:72

◆ FFTDirection

enum FFTDirection
strong

FFT direction to use.

Enumerator
Forward 
Inverse 

Definition at line 34 of file FunctionDescriptors.h.

◆ Format

enum Format
strong

Image colour formats.

Enumerator
UNKNOWN 

Unknown image format.

U8 

1 channel, 1 U8 per channel

S16 

1 channel, 1 S16 per channel

U16 

1 channel, 1 U16 per channel

S32 

1 channel, 1 S32 per channel

U32 

1 channel, 1 U32 per channel

BFLOAT16 

16-bit brain floating-point number

F16 

1 channel, 1 F16 per channel

F32 

1 channel, 1 F32 per channel

UV88 

2 channel, 1 U8 per channel

RGB888 

3 channels, 1 U8 per channel

RGBA8888 

4 channels, 1 U8 per channel

YUV444 

A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.

YUYV422 

A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.

NV12 

A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.

NV21 

A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.

IYUV 

A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.

UYVY422 

A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.

Definition at line 56 of file Types.h.

57 {
58  UNKNOWN, /**< Unknown image format */
59  U8, /**< 1 channel, 1 U8 per channel */
60  S16, /**< 1 channel, 1 S16 per channel */
61  U16, /**< 1 channel, 1 U16 per channel */
62  S32, /**< 1 channel, 1 S32 per channel */
63  U32, /**< 1 channel, 1 U32 per channel */
64  BFLOAT16, /**< 16-bit brain floating-point number */
65  F16, /**< 1 channel, 1 F16 per channel */
66  F32, /**< 1 channel, 1 F32 per channel */
67  UV88, /**< 2 channel, 1 U8 per channel */
68  RGB888, /**< 3 channels, 1 U8 per channel */
69  RGBA8888, /**< 4 channels, 1 U8 per channel */
70  YUV444, /**< A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes */
71  YUYV422, /**< A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes */
72  NV12, /**< A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling */
73  NV21, /**< A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling */
74  IYUV, /**< A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes */
75  UYVY422 /**< A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte */
76 };
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
Unknown CL kernel type.
Definition: CLTypes.h:82
1 channel, 1 U8 per channel
1 channel, 1 F32 per channel
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
1 channel, 1 U16 per channel
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
1 channel, 1 F16 per channel
1 channel, 1 S32 per channel
16-bit brain floating-point number
3 channels, 1 U8 per channel
1 channel, 1 U32 per channel
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
1 channel, 1 S16 per channel
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
4 channels, 1 U8 per channel
2 channel, 1 U8 per channel
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.

◆ FuseBatchNormalizationType

Available FuseBatchNormalizationType.

Enumerator
CONVOLUTION 

For Convolution weights.

DEPTHWISECONVOLUTION 

For Depthwise Convolution weights.

Definition at line 158 of file Types.h.

159 {
160  CONVOLUTION, /**< For Convolution weights */
161  DEPTHWISECONVOLUTION /**< For Depthwise Convolution weights*/
162 };

◆ GEMMLowpOutputStageType

GEMMLowp output stage type.

Enumerator
NONE 

No quantization.

QUANTIZE_DOWN 

Quantize using an integer multiplication.

QUANTIZE_DOWN_FIXEDPOINT 

Quantize using a fixed point multiplication.

QUANTIZE_DOWN_FLOAT 

Quantize using a floating point multiplication.

Definition at line 2278 of file Types.h.

2279 {
2280  NONE, /**< No quantization */
2281  QUANTIZE_DOWN, /**< Quantize using an integer multiplication */
2282  QUANTIZE_DOWN_FIXEDPOINT, /**< Quantize using a fixed point multiplication */
2283  QUANTIZE_DOWN_FLOAT /**< Quantize using a floating point multiplication */
2284 };
Quantize using a fixed point multiplication.
Quantize using a floating point multiplication.
Quantize using an integer multiplication.

◆ GPUTarget

enum GPUTarget
strong

Available GPU Targets.

Enumerator
UNKNOWN 
GPU_ARCH_MASK 
GPU_GENERATION_MASK 
MIDGARD 
BIFROST 
VALHALL 
T600 
T700 
T800 
G71 
G72 
G51 
G51BIG 
G51LIT 
G31 
G76 
G52 
G52LIT 
G77 
G57 
G78 
G68 
G78AE 
G710 
G610 
G510 
G310 
G715 
G615 

Definition at line 34 of file GPUTarget.h.

35 {
36  UNKNOWN = 0x101,
37  GPU_ARCH_MASK = 0xF00,
38  GPU_GENERATION_MASK = 0x0F0,
39  MIDGARD = 0x100,
40  BIFROST = 0x200,
41  VALHALL = 0x300,
42  T600 = 0x110,
43  T700 = 0x120,
44  T800 = 0x130,
45  G71 = 0x210,
46  G72 = 0x220,
47  G51 = 0x221,
48  G51BIG = 0x222,
49  G51LIT = 0x223,
50  G31 = 0x224,
51  G76 = 0x230,
52  G52 = 0x231,
53  G52LIT = 0x232,
54  G77 = 0x310,
55  G57 = 0x311,
56  G78 = 0x320,
57  G68 = 0x321,
58  G78AE = 0x330,
59  G710 = 0x340,
60  G610 = 0x341,
61  G510 = 0x342,
62  G310 = 0x343,
63  G715 = 0x350,
64  G615 = 0x351,
65 };
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ ImportMemoryType

enum ImportMemoryType
strong
Enumerator
HostPtr 

Definition at line 57 of file Types.h.

◆ InterpolationPolicy

enum InterpolationPolicy
strong

Interpolation method.

Enumerator
NEAREST_NEIGHBOR 

Output values are defined to match the source pixel whose center is nearest to the sample position.

BILINEAR 

Output values are defined by bilinear interpolation between the pixels.

AREA 

Output values are determined by averaging the source pixels whose areas fall under the area of the destination pixel, projected onto the source image.

Definition at line 411 of file Types.h.

412 {
413  NEAREST_NEIGHBOR, /**< Output values are defined to match the source pixel whose center is nearest to the sample position */
414  BILINEAR, /**< Output values are defined by bilinear interpolation between the pixels */
415  AREA, /**< Output values are determined by averaging the source pixels whose areas fall under the area of the destination pixel, projected onto the source image */
416 };
Output values are defined by bilinear interpolation between the pixels.
Output values are defined to match the source pixel whose center is nearest to the sample position...
Output values are determined by averaging the source pixels whose areas fall under the area of the de...

◆ LogicalOperation

enum LogicalOperation
strong

List of supported logical operations.

Enumerator
Unknown 

Unknown.

And 

Logical And &&.

Or 

Logical Or ||.

Not 

Logical Not !

Definition at line 30 of file KernelTypes.h.

31 {
32  Unknown, /**< Unknown */
33  And, /**< Logical And && */
34  Or, /**< Logical Or || */
35  Not, /**< Logical Not ! */
36 };

◆ MappingType

enum MappingType
strong

Mapping type.

Enumerator
BLOBS 

Mappings are in blob granularity.

OFFSETS 

Mappings are in offset granularity in the same blob.

Definition at line 34 of file Types.h.

35 {
36  BLOBS, /**< Mappings are in blob granularity */
37  OFFSETS /**< Mappings are in offset granularity in the same blob */
38 };
Mappings are in blob granularity.
Mappings are in offset granularity in the same blob.

◆ NMSType

enum NMSType
strong

Available non maxima suppression types.

Enumerator
LINEAR 

Linear NMS.

GAUSSIAN 

Gaussian NMS.

ORIGINAL 

Original NMS.

Definition at line 565 of file Types.h.

566 {
567  LINEAR, /**< Linear NMS */
568  GAUSSIAN, /**< Gaussian NMS */
569  ORIGINAL /**< Original NMS */
570 };

◆ NormType

enum NormType
strong

The normalization type used for the normalization layer.

Enumerator
IN_MAP_1D 

Normalization applied within the same map in 1D region.

IN_MAP_2D 

Normalization applied within the same map in 2D region.

CROSS_MAP 

Normalization applied cross maps.

Definition at line 524 of file Types.h.

525 {
526  IN_MAP_1D, /**< Normalization applied within the same map in 1D region */
527  IN_MAP_2D, /**< Normalization applied within the same map in 2D region */
528  CROSS_MAP /**< Normalization applied cross maps */
529 };
Normalization applied within the same map in 1D region.
Normalization applied cross maps.
Normalization applied within the same map in 2D region.

◆ PaddingMode

enum PaddingMode
strong

Padding mode to use for PadLayer.

Enumerator
CONSTANT 
REFLECT 
SYMMETRIC 

Definition at line 165 of file Types.h.

◆ PoolingType

enum PoolingType
strong

Available pooling types.

Enumerator
MAX 

Max Pooling.

AVG 

Average Pooling.

L2 

L2 Pooling.

Definition at line 557 of file Types.h.

558 {
559  MAX, /**< Max Pooling */
560  AVG, /**< Average Pooling */
561  L2 /**< L2 Pooling */
562 };
#define MAX(x, y)

◆ ReductionOperation

enum ReductionOperation
strong

Available reduction operations.

Enumerator
ARG_IDX_MAX 

Index of the max value.

ARG_IDX_MIN 

Index of the min value.

MEAN_SUM 

Mean of sum.

PROD 

Product.

SUM_SQUARE 

Sum of squares.

SUM 

Sum.

MIN 

Min.

MAX 

Max.

Definition at line 476 of file Types.h.

477 {
478  ARG_IDX_MAX, /**< Index of the max value */
479  ARG_IDX_MIN, /**< Index of the min value */
480  MEAN_SUM, /**< Mean of sum */
481  PROD, /**< Product */
482  SUM_SQUARE, /**< Sum of squares */
483  SUM, /**< Sum */
484  MIN, /**< Min */
485  MAX, /**< Max */
486 };
#define MAX(x, y)
#define MIN(x, y)

◆ RoundingPolicy

enum RoundingPolicy
strong

Rounding method.

Enumerator
TO_ZERO 

Truncates the least significant values that are lost in operations.

TO_NEAREST_UP 

Rounds to nearest value; half rounds away from zero.

TO_NEAREST_EVEN 

Rounds to nearest value; half rounds to nearest even.

Definition at line 30 of file Rounding.h.

31 {
32  TO_ZERO, /**< Truncates the least significant values that are lost in operations. */
33  TO_NEAREST_UP, /**< Rounds to nearest value; half rounds away from zero */
34  TO_NEAREST_EVEN, /**< Rounds to nearest value; half rounds to nearest even */
35 };
Rounds to nearest value; half rounds away from zero.
Rounds to nearest value; half rounds to nearest even.
Truncates the least significant values that are lost in operations.

◆ SamplingPolicy

enum SamplingPolicy
strong

Available Sampling Policies.

Enumerator
CENTER 

Samples are taken at pixel center.

TOP_LEFT 

Samples are taken at pixel top left corner.

Definition at line 104 of file Types.h.

105 {
106  CENTER, /**< Samples are taken at pixel center */
107  TOP_LEFT /**< Samples are taken at pixel top left corner */
108 };
Samples are taken at pixel center.
Samples are taken at pixel top left corner.

◆ StatusCode

enum StatusCode
strong
Enumerator
Success 
RuntimeError 
OutOfMemory 
Unimplemented 
UnsupportedTarget 
InvalidTarget 
InvalidArgument 
UnsupportedConfig 
InvalidObjectState 

Definition at line 32 of file Types.h.

33 {
43 };
Call failed during execution.
Definition: AclTypes.h:52
Call failed as invalid argument was passed.
Definition: AclTypes.h:56
Call failed as invalid argument was passed.
Definition: AclTypes.h:57
Call failed as an invalid backend was requested.
Definition: AclTypes.h:55
Call failed as configuration is unsupported.
Definition: AclTypes.h:58
Call succeeded, leading to valid state for all involved objects/data.
Definition: AclTypes.h:51
Call failed as requested capability is not implemented.
Definition: AclTypes.h:54
Call failed due to failure to allocate resources.
Definition: AclTypes.h:53
Call failed as an object has invalid state.
Definition: AclTypes.h:59

◆ Target

enum Target
strong
Enumerator
Cpu 
GpuOcl 

Definition at line 45 of file Types.h.

46 {
49 };
OpenCL target for GPU.
Definition: AclTypes.h:66
Cpu target that uses SIMD extensions.
Definition: AclTypes.h:65
Cpu target that leverages SIMD.
Gpu target that leverages OpenCL.

◆ TensorType

enum TensorType : int32_t

Memory type.

Enumerator
ACL_UNKNOWN 
ACL_SRC_DST 
ACL_SRC 
ACL_SRC_0 
ACL_SRC_1 
ACL_SRC_2 
ACL_SRC_3 
ACL_SRC_4 
ACL_SRC_5 
ACL_SRC_6 
ACL_SRC_END 
ACL_DST 
ACL_DST_0 
ACL_DST_1 
ACL_DST_2 
ACL_DST_END 
ACL_INT 
ACL_INT_0 
ACL_INT_1 
ACL_INT_2 
ACL_INT_3 
ACL_INT_4 
ACL_SRC_VEC 
ACL_DST_VEC 
ACL_INT_VEC 
ACL_BIAS 
ACL_VEC_ROW_SUM 
ACL_VEC_COL_SUM 
ACL_SHIFTS 
ACL_MULTIPLIERS 
EXPERIMENTAL_ACL_POST_OP_ARG 
EXPERIMENTAL_ACL_POST_OP_ARG_FIRST 
EXPERIMENTAL_ACL_POST_OP_ARG_LAST 

Definition at line 38 of file Types.h.

38  : int32_t
39 {
40  ACL_UNKNOWN = -1,
41  ACL_SRC_DST = 0,
42 
43  // Src
44  ACL_SRC = 0,
45  ACL_SRC_0 = 0,
46  ACL_SRC_1 = 1,
47  ACL_SRC_2 = 2,
48  ACL_SRC_3 = 3,
49  ACL_SRC_4 = 4,
50  ACL_SRC_5 = 5,
51  ACL_SRC_6 = 6,
52  ACL_SRC_END = 6,
53 
54  // Dst
55  ACL_DST = 30,
56  ACL_DST_0 = 30,
57  ACL_DST_1 = 31,
58  ACL_DST_2 = 32,
59  ACL_DST_END = 32,
60 
61  // Aux
62  ACL_INT = 50,
63  ACL_INT_0 = 50,
64  ACL_INT_1 = 51,
65  ACL_INT_2 = 52,
66  ACL_INT_3 = 53,
67  ACL_INT_4 = 54,
68  ACL_SRC_VEC = 256,
69  ACL_DST_VEC = 512,
70  ACL_INT_VEC = 1024,
71 
72  // Aliasing Types
73  // Conv etc
75 
76  // Gemm
81 
82  // (EXPERIMENTAL_POST_OPS) Post ops arguments begin after everything else
85  EXPERIMENTAL_ACL_POST_OP_ARG_LAST = EXPERIMENTAL_ACL_POST_OP_ARG_FIRST + 1024, // Max number of post op arguments
86 };

◆ WeightFormat

enum WeightFormat
strong

Memory layouts for the weights tensor.

  • UNSPECIFIED is used to select kernels that do not run in variable weights mode.
  • ANY is used to query the kernel database to retrieve any of the kernels that runs in variable weights mode. Once a kernel is found, the specific format expected by the kernel can be retrieved by the user for reordering the weights tensor accordingly.

The other values OHWIo{interleave_by}i{block_by} describe the memory layout of a 4D tensor with layout OHWI that has been transformed into a 4D tensor with dimensions O'HWI' where:

O' = first multiple of {interleave_by} s.t. O<=O' I' = first multiple of {block_by} s.t. I<=I'

The total size of the dst tensor is O' x H x W x I'

The access function of the tensor with layout OHWIo{interleave_by}i{block_by} and size O'HWI' is a 6-parameter access function, where the 6 parameters are computed as follows:

x5 = floor(o/{interleave_by}) RANGE [0, O'/{interleave_by} -1] SIZE: O'/{interleave_by}

x4 = h RANGE [0, H-1] SIZE: H x3 = w RANGE [0, W-1] SIZE: W x2 = floor(i/{block_by}) RANGE [0, I'/{block_by} -1] SIZE: I'/{block_by} x1 = o%{interleave_by} RANGE [0, {interleave_by} -1] SIZE: {interleave_by} x0 = i%{block_by} RANGE [0, {block_by} -1] SIZE: {block_by} TOTAL SIZE: O' * H * W * I'

4D 6D


value(o, h, w, i) = x5 * H * W * I' * {interleave_by}

  • x4 * W * I' * {interleave_by}
  • x3 * I' * {interleave_by}
  • x2 * {interleave_by} * {block_by}
  • x1 * {block_by}
  • x0

Notice that in arm_gemm the 4D tensor of dimension O'HWI' created for the OHWIo{interleave_by}i{block_by} format is in reality seen as a 2D tensor, where the number of rows is O'/{interleave_by} and the number of columns is {interleave_by} * H * W * I'.

The postfix *_bf16 is for the memory layout needed for the fast-mode kernels, in which the weights are passed in bfloat16 format.

Enumerator
UNSPECIFIED 
ANY 
OHWI 
OHWIo2 
OHWIo4 
OHWIo8 
OHWIo16 
OHWIo32 
OHWIo64 
OHWIo128 
OHWIo4i2 
OHWIo4i2_bf16 
OHWIo8i2 
OHWIo8i2_bf16 
OHWIo16i2 
OHWIo16i2_bf16 
OHWIo32i2 
OHWIo32i2_bf16 
OHWIo64i2 
OHWIo64i2_bf16 
OHWIo4i4 
OHWIo4i4_bf16 
OHWIo8i4 
OHWIo8i4_bf16 
OHWIo16i4 
OHWIo16i4_bf16 
OHWIo32i4 
OHWIo32i4_bf16 
OHWIo64i4 
OHWIo64i4_bf16 
OHWIo2i8 
OHWIo4i8 
OHWIo8i8 
OHWIo16i8 
OHWIo32i8 
OHWIo64i8 

Definition at line 2015 of file Types.h.

2016 {
2017  UNSPECIFIED = 0x1,
2018  ANY = 0x2,
2019  OHWI = 0x100100,
2020  OHWIo2 = 0x100200,
2021  OHWIo4 = 0x100400,
2022  OHWIo8 = 0x100800,
2023  OHWIo16 = 0x101000,
2024  OHWIo32 = 0x102000,
2025  OHWIo64 = 0x104000,
2026  OHWIo128 = 0x108000,
2027  OHWIo4i2 = 0x200400,
2028  OHWIo4i2_bf16 = 0x200410,
2029  OHWIo8i2 = 0x200800,
2030  OHWIo8i2_bf16 = 0x200810,
2031  OHWIo16i2 = 0x201000,
2032  OHWIo16i2_bf16 = 0x201010,
2033  OHWIo32i2 = 0x202000,
2034  OHWIo32i2_bf16 = 0x202010,
2035  OHWIo64i2 = 0x204000,
2036  OHWIo64i2_bf16 = 0x204010,
2037  OHWIo4i4 = 0x400400,
2038  OHWIo4i4_bf16 = 0x400410,
2039  OHWIo8i4 = 0x400800,
2040  OHWIo8i4_bf16 = 0x400810,
2041  OHWIo16i4 = 0x401000,
2042  OHWIo16i4_bf16 = 0x401010,
2043  OHWIo32i4 = 0x402000,
2044  OHWIo32i4_bf16 = 0x402010,
2045  OHWIo64i4 = 0x404000,
2046  OHWIo64i4_bf16 = 0x404010,
2047  OHWIo2i8 = 0x800200,
2048  OHWIo4i8 = 0x800400,
2049  OHWIo8i8 = 0x800800,
2050  OHWIo16i8 = 0x801000,
2051  OHWIo32i8 = 0x802000,
2052  OHWIo64i8 = 0x804000
2053 };

Function Documentation

◆ adjust_down()

int arm_compute::adjust_down ( int  required,
int  available,
int  step 
)
inline

Decrease required in steps of step until it's less than available.

Parameters
[in]requiredNumber of required bytes.
[in]availableNumber of available bytes.
[in]stepStep size used to decrease required bytes.
Returns
Largest value smaller than available that is a multiple of step

Definition at line 47 of file IAccessWindow.h.

References ARM_COMPUTE_ERROR_ON.

Referenced by AccessWindowTranspose::update_window_if_needed(), and AccessWindowRectangle::update_window_if_needed().

48 {
50 
51  return required - step * ((required - available + step - 1) / step);
52 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
constexpr int step
Definition: fp32.cpp:35

◆ adjust_odd_shape()

TensorShape arm_compute::adjust_odd_shape ( const TensorShape shape,
Format  format 
)
inline

Adjust tensor shape size if width or height are odd for a given multi-planar format.

No modification is done for other formats.

Note
Adding here a few links discussing the issue of odd size and sharing the same solution: Android Source WebM libYUV YUVPlayer *
Parameters
[in,out]shapeTensor shape of 2D size
[in]formatFormat of the tensor
Returns
The adjusted tensor shape.

Definition at line 671 of file Utils.h.

References has_format_horizontal_subsampling(), has_format_vertical_subsampling(), TensorShape::set(), and arm_compute::utils::cast::U.

Referenced by error_on_tensors_not_even().

672 {
673  TensorShape output{ shape };
674 
675  // Force width to be even for formats which require subsampling of the U and V channels
677  {
678  output.set(0, (output.x() + 1) & ~1U);
679  }
680 
681  // Force height to be even for formats which require subsampling of the U and V channels
683  {
684  output.set(1, (output.y() + 1) & ~1U);
685  }
686 
687  return output;
688 }
bool has_format_vertical_subsampling(Format format)
Return true if the given format has vertical subsampling.
Definition: Utils.h:653
bool has_format_horizontal_subsampling(Format format)
Return true if the given format has horizontal subsampling.
Definition: Utils.h:642

◆ adjust_up()

int arm_compute::adjust_up ( int  required,
int  available,
int  step 
)
inline

Increase required in steps of step until it's greater than available.

Parameters
[in]requiredNumber of required bytes.
[in]availableNumber of available bytes.
[in]stepStep size used to increase required bytes.
Returns
Largest value smaller than available that is a multiple of step

Definition at line 63 of file IAccessWindow.h.

References ARM_COMPUTE_ERROR_ON.

Referenced by AccessWindowTranspose::update_window_if_needed(), and AccessWindowRectangle::update_window_if_needed().

64 {
66 
67  return required + step * ((available - required + step - 1) / step);
68 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
constexpr int step
Definition: fp32.cpp:35

◆ adjust_vec_size()

unsigned int arm_compute::adjust_vec_size ( unsigned int  vec_size,
size_t  dim0 
)
inline

Returns the adjusted vector size in case it is less than the input's first dimension, getting rounded down to its closest valid vector size.

Parameters
[in]vec_sizevector size to be adjusted
[in]dim0size of the first dimension
Returns
the number of element processed along the X axis per thread

Definition at line 1222 of file Utils.h.

References ARM_COMPUTE_ERROR_ON.

Referenced by ClFloorKernel::configure(), ClTransposeKernel::configure(), ClCopyKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClActivationKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool3dKernel::configure(), ClPool2dKernel::configure(), ClWidthConcatenateKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), ClDepthConcatenateKernel::configure(), CLBitwiseKernel::configure(), CLChannelShuffleLayerKernel::configure(), CLSelectKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), ClCastKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLNormalizationLayerKernel::configure(), ClGemmLowpOffsetContributionKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLRangeKernel::configure(), ClDirectConv2dKernel::configure(), CLReductionOperationKernel::configure(), CLPadLayerKernel::configure(), ClDirectConv3dKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLArgMinMaxLayerKernel::configure(), CLBatchNormalizationLayerKernel::configure(), ClLogits1DNormKernel::configure(), ClGemmLowpMatrixBReductionKernel::configure(), ClDirectConvolutionKernelComponent::generate_build_options(), ClTemplateDirectConv2d::get_build_options(), ClDirectConvolutionKernelComponent::get_component_code(), ClTemplateDirectConv2d::get_component_code(), ClFloorKernelComponent::get_window(), and ClElementwiseKernelComponent::get_window().

1223 {
1224  ARM_COMPUTE_ERROR_ON(vec_size > 16);
1225 
1226  if((vec_size >= dim0) && (dim0 == 3))
1227  {
1228  return dim0;
1229  }
1230 
1231  while(vec_size > dim0)
1232  {
1233  vec_size >>= 1;
1234  }
1235 
1236  return vec_size;
1237 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466

◆ arm_matrix_multiply_supported()

bool arm_matrix_multiply_supported ( const cl::Device &  device)

Helper function to check whether the cl_arm_matrix_multiply extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 494 of file CLHelpers.cpp.

References device_supports_extension().

Referenced by arm_compute::test::validation::FIXTURE_DATA_TEST_CASE().

495 {
496  return device_supports_extension(device, "cl_arm_matrix_multiply");
497 }
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283

◆ arm_non_uniform_workgroup_supported()

bool arm_non_uniform_workgroup_supported ( const cl::Device &  device)

Helper function to check whether the arm_non_uniform_work_group_size extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 231 of file CLHelpers.cpp.

References device_supports_extension().

232 {
233  return device_supports_extension(device, "cl_arm_non_uniform_work_group_size");
234 }
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283

◆ auto_init_if_empty() [1/2]

bool arm_compute::auto_init_if_empty ( ITensorInfo info,
const TensorShape shape,
int  num_channels,
DataType  data_type,
QuantizationInfo  quantization_info = QuantizationInfo() 
)
inline

Auto initialize the tensor info (shape, number of channels and data type) if the current assignment is empty.

Parameters
[in,out]infoTensor info used to check and assign.
[in]shapeNew shape.
[in]num_channelsNew number of channels.
[in]data_typeNew data type
[in]quantization_info(Optional) New quantization info
Returns
True if the tensor info has been initialized

Definition at line 42 of file AutoConfiguration.h.

References ITensorInfo::set_data_type(), ITensorInfo::set_num_channels(), ITensorInfo::set_quantization_info(), ITensorInfo::set_tensor_shape(), ITensorInfo::tensor_shape(), and TensorShape::total_size().

Referenced by arm_compute::experimental::dynamic_fusion::add_op_conv2d(), arm_compute::experimental::dynamic_fusion::add_op_elementwise_op(), arm_compute::experimental::dynamic_fusion::add_op_floor(), CpuTransposeKernel::configure(), CpuDequantizeKernel::configure(), ClDequantizeKernel::configure(), ClFloorKernel::configure(), ClTransposeKernel::configure(), CpuFloorKernel::configure(), CpuPermuteKernel::configure(), CpuLogits1DMaxKernel::configure(), ClCopyKernel::configure(), ClActivationKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), CpuActivationKernel::configure(), CPPDetectionOutputLayer::configure(), ClPermuteKernel::configure(), CLStridedSliceKernel::configure(), CpuConvertFullyConnectedWeightsKernel::configure(), CpuElementwiseUnaryKernel::configure(), CpuConcatenate::configure(), CpuDirectConv2dOutputStageKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), CpuGemmLowpMatrixAReductionKernel::configure(), CpuMaxUnpoolingLayerKernel::configure(), NETileKernel::configure(), NEReverseKernel::configure(), CpuDirectConv2dKernel::configure(), NEChannelShuffleLayerKernel::configure(), NEDepthToSpaceLayerKernel::configure(), NESpaceToDepthLayerKernel::configure(), ClConcatenate::configure(), CpuPool3dKernel::configure(), NEComputeAllAnchorsKernel::configure(), CPPTopKVKernel::configure(), NEReorgLayerKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), NEQLSTMLayerNormalizationKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CLBitwiseKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), CLReverseKernel::configure(), CLSelectKernel::configure(), NENormalizationLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), CPPPermuteKernel::configure(), CpuGemmInterleave4x4Kernel::configure(), NEPadLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), CLDepthToSpaceLayerKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLComputeAllAnchorsKernel::configure(), NERangeKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), CpuDirectConv3dKernel::configure(), NEFlattenLayer::configure(), NEBoundingBoxTransformKernel::configure(), CLFFTScaleKernel::configure(), NEFFTRadixStageKernel::configure(), NEROIPoolingLayerKernel::configure(), CpuDepthwiseConv2dNativeKernel::configure(), CpuGemmLowpQuantizeDownInt32ScaleKernel::configure(), NEBatchToSpaceLayerKernel::configure(), CpuDepthwiseConv2dAssemblyWrapperKernel::configure(), CLTileKernel::configure(), CPPDetectionPostProcessLayer::configure(), CLReorgLayerKernel::configure(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::configure(), CpuCol2ImKernel::configure(), NEReductionOperationKernel::configure(), NESelectKernel::configure(), CPPNonMaximumSuppressionKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), NEFuseBatchNormalizationKernel::configure(), CpuPool2dAssemblyWrapperKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::configure(), NEBatchNormalizationLayerKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLReductionOperationKernel::configure(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::configure(), CpuGemmMatrixMultiplyKernel::configure(), NEGatherKernel::configure(), ClDirectConv2dKernel::configure(), NEROIAlignLayerKernel::configure(), CLPadLayerKernel::configure(), NESpaceToBatchLayerKernel::configure(), CLL2NormalizeLayerKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), NEReduceMean::configure(), CpuWeightsReshapeKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLFlattenLayer::configure(), CLReduceMean::configure(), CLROIPoolingLayerKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), ClWeightsReshapeKernel::configure(), NEReductionOperation::configure(), CLArgMinMaxLayerKernel::configure(), CpuIm2ColKernel::configure(), CLROIAlignLayerKernel::configure(), CpuGemmTranspose1xWKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLFuseBatchNormalizationKernel::configure(), CLBatchNormalizationLayerKernel::configure(), NEPadLayer::configure(), CpuGemmLowpOffsetContributionOutputStageKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLReductionOperation::configure(), CLArgMinMaxLayer::configure(), NEFFTConvolutionLayer::configure(), NEGenerateProposalsLayer::configure(), CpuLogits1DSoftmaxKernel< IS_LOG >::configure(), ClComplexMulKernel::configure(), CLCropResize::configure(), ClLogits1DNormKernel::configure(), NELSTMLayerQuantized::configure(), ClGemmLowpMatrixBReductionKernel::configure(), CLComputeMeanVariance::configure(), NEDeconvolutionLayer::configure(), CLFFTConvolutionLayer::configure(), CpuGemmLowpMatrixBReductionKernel::configure(), CLGenerateProposalsLayer::configure(), CLDirectDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), CpuComplexMulKernel::configure(), GpuConv2d::create_op(), CpuComparisonKernel::get_available_kernels(), ClDirectConvolutionKernelComponent::get_window(), ClFloorKernelComponent::get_window(), ClElementwiseKernelComponent::get_window(), CpuGemm::validate(), ClGemmLowpMatrixMultiplyCore::validate(), ClGemmConv2d::validate(), CpuGemmLowpMatrixMultiplyCore::validate(), and GpuConv2d::validate_op().

46 {
47  if(info.tensor_shape().total_size() == 0)
48  {
49  info.set_data_type(data_type);
50  info.set_num_channels(num_channels);
51  info.set_tensor_shape(shape);
52  info.set_quantization_info(quantization_info);
53  return true;
54  }
55 
56  return false;
57 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ auto_init_if_empty() [2/2]

bool arm_compute::auto_init_if_empty ( ITensorInfo info_sink,
const ITensorInfo info_source 
)
inline

Auto initialize the tensor info using another tensor info.

Parameters
info_sinkTensor info used to check and assign
info_sourceTensor info used to assign
Returns
True if the tensor info has been initialized

Definition at line 66 of file AutoConfiguration.h.

References ITensorInfo::data_layout(), ITensorInfo::data_type(), ITensorInfo::num_channels(), ITensorInfo::quantization_info(), ITensorInfo::set_data_layout(), ITensorInfo::set_data_type(), ITensorInfo::set_num_channels(), ITensorInfo::set_quantization_info(), ITensorInfo::set_tensor_shape(), ITensorInfo::tensor_shape(), and TensorShape::total_size().

67 {
68  if(info_sink.tensor_shape().total_size() == 0)
69  {
70  info_sink.set_data_type(info_source.data_type());
71  info_sink.set_num_channels(info_source.num_channels());
72  info_sink.set_tensor_shape(info_source.tensor_shape());
73  info_sink.set_quantization_info(info_source.quantization_info());
74  info_sink.set_data_layout(info_source.data_layout());
75  return true;
76  }
77 
78  return false;
79 }

◆ block_by()

int arm_compute::block_by ( const WeightFormat  wf)
inline

Definition at line 2059 of file Types.h.

2060 {
2061  return (static_cast<int>(wf) >> 20) & 0xF;
2062 }

◆ build_information()

std::string arm_compute::build_information ( )

Returns the arm_compute library build information.

Contains the version number and the build options used to build the library

Returns
The arm_compute library build information

Referenced by main(), and arm_compute::utils::run_example().

◆ calculate_max_enlarged_window()

Window arm_compute::calculate_max_enlarged_window ( const ValidRegion valid_region,
const Steps steps,
BorderSize  border_size 
)

Definition at line 133 of file WindowHelpers.cpp.

References ValidRegion::anchor, BorderSize::bottom, ceil_to_multiple(), BorderSize::left, arm_compute::test::validation::n, Dimensions< T >::num_dimensions(), Dimensions< int >::num_max_dimensions, BorderSize::right, Window::set(), arm_compute::test::validation::shape, ValidRegion::shape, and BorderSize::top.

Referenced by intersect_valid_regions().

134 {
135  const Coordinates &anchor = valid_region.anchor;
136  const TensorShape &shape = valid_region.shape;
137 
138  Window window;
139 
140  window.set(0, Window::Dimension(
141  // move the anchor to the start from the border
142  anchor[0] - border_size.left,
143  // move the anchor to include the right end border
144  // Make sure the window width is a multiple of the step size
145  anchor[0] - border_size.left + ceil_to_multiple(shape[0] + border_size.left + border_size.right, steps[0]),
146  steps[0]));
147 
148  size_t n = 1;
149 
150  if(anchor.num_dimensions() > 1)
151  {
152  window.set(1, Window::Dimension(
153  // Include the border above the image
154  anchor[1] - border_size.top,
155  // Include the border below the image
156  anchor[1] - border_size.top + ceil_to_multiple(shape[1] + border_size.top + border_size.bottom, steps[1]),
157  steps[1]));
158 
159  ++n;
160  }
161 
162  if(anchor.num_dimensions() > 2)
163  {
164  window.set(2, Window::Dimension(0, std::max<size_t>(1, shape[n]), steps[2]));
165 
166  ++n;
167  }
168 
169  for(; n < anchor.num_dimensions(); ++n)
170  {
171  window.set(n, Window::Dimension(anchor[n], std::max<size_t>(1, shape[n])));
172  }
173 
174  for(; n < Coordinates::num_max_dimensions; ++n)
175  {
176  window.set(n, Window::Dimension(0, 1));
177  }
178 
179  return window;
180 }
TensorShape shape
Shape of the valid region.
Definition: Types.h:266
const ValidRegion valid_region
Definition: Scale.cpp:214
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Definition: Utils.h:71
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:79
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:265

◆ calculate_max_window() [1/2]

Window arm_compute::calculate_max_window ( const ValidRegion valid_region,
const Steps steps,
bool  skip_border,
BorderSize  border_size 
)

Definition at line 28 of file WindowHelpers.cpp.

References ValidRegion::anchor, BorderSize::bottom, ceil_to_multiple(), BorderSize::left, arm_compute::test::validation::n, Dimensions< T >::num_dimensions(), Dimensions< int >::num_max_dimensions, BorderSize::right, Window::set(), arm_compute::test::validation::shape, ValidRegion::shape, and BorderSize::top.

Referenced by CpuDequantizeKernel::configure(), CpuReshapeKernel::configure(), CpuTransposeKernel::configure(), CpuFillKernel::configure(), ClReshapeKernel::configure(), ClTransposeKernel::configure(), ClDequantizeKernel::configure(), ClFloorKernel::configure(), CpuConcatenateBatchKernel::configure(), CpuFloorKernel::configure(), CpuLogits1DMaxKernel::configure(), CpuPermuteKernel::configure(), ClCopyKernel::configure(), ClElementWiseUnaryKernel::configure(), ClFillKernel::configure(), NELogicalKernel::configure(), CpuConcatenateHeightKernel::configure(), CpuConcatenateWidthKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), CpuQuantizeKernel::configure(), ClPool2dKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool3dKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClQuantizeKernel::configure(), ClPermuteKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), CpuPool2dKernel::configure(), CpuConvertFullyConnectedWeightsKernel::configure(), CLStridedSliceKernel::configure(), ClBatchConcatenateKernel::configure(), ClDepthConcatenateKernel::configure(), ClCropKernel::configure(), CpuConcatenateDepthKernel::configure(), CpuDirectConv2dOutputStageKernel::configure(), ICLSimpleKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), NEBatchToSpaceLayerKernel::configure(), NETileKernel::configure(), CpuGemmLowpMatrixAReductionKernel::configure(), CpuMaxUnpoolingLayerKernel::configure(), NEReverseKernel::configure(), NESpaceToDepthLayerKernel::configure(), NEChannelShuffleLayerKernel::configure(), NEDepthToSpaceLayerKernel::configure(), NEPriorBoxLayerKernel::configure(), CpuGemmLowpMatrixMultiplyKernel::configure(), CpuPool3dKernel::configure(), NEComputeAllAnchorsKernel::configure(), NEReorgLayerKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), CPPUpsampleKernel::configure(), NEBitwiseNotKernel::configure(), CLBitwiseKernel::configure(), CpuScaleKernel::configure(), NEQLSTMLayerNormalizationKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), NESpaceToBatchLayerKernel::configure(), CPPPermuteKernel::configure(), CLReverseKernel::configure(), NEBitwiseAndKernel::configure(), NEBitwiseXorKernel::configure(), NEBitwiseOrKernel::configure(), CLSelectKernel::configure(), NENormalizationLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CLDepthToSpaceLayerKernel::configure(), CpuGemmInterleave4x4Kernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), NEPadLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLComputeAllAnchorsKernel::configure(), ClCastKernel::configure(), CLDeconvolutionLayerUpsampleKernel::configure(), NERangeKernel::configure(), CPPBoxWithNonMaximaSuppressionLimitKernel::configure(), CpuDepthwiseConv2dNativeKernel::configure(), CpuDirectConv3dKernel::configure(), CLFFTScaleKernel::configure(), CpuGemmLowpOffsetContributionKernel::configure(), CpuGemmMatrixAdditionKernel::configure(), NEBoundingBoxTransformKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CpuCastKernel::configure(), CLTileKernel::configure(), CpuGemmLowpQuantizeDownInt32ScaleKernel::configure(), CpuDepthwiseConv2dAssemblyWrapperKernel::configure(), NEReductionOperationKernel::configure(), CpuGemmLowpQuantizeDownInt32ToInt16ScaleByFixedPointKernel::configure(), CLReorgLayerKernel::configure(), CpuCol2ImKernel::configure(), CPPNonMaximumSuppressionKernel::configure(), NESelectKernel::configure(), CpuPool2dAssemblyWrapperKernel::configure(), ClGemmLowpOffsetContributionKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), NEFuseBatchNormalizationKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), NEBatchNormalizationLayerKernel::configure(), CLRangeKernel::configure(), CLReductionOperationKernel::configure(), ClDirectConv2dKernel::configure(), NEGatherKernel::configure(), CpuGemmLowpQuantizeDownInt32ToInt8ScaleByFixedPointKernel::configure(), CpuGemmLowpQuantizeDownInt32ToUint8ScaleByFixedPointKernel::configure(), CpuGemmMatrixMultiplyKernel::configure(), CLPadLayerKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClDirectConv3dKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), CpuWeightsReshapeKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), CLROIPoolingLayerKernel::configure(), ClWeightsReshapeKernel::configure(), CLArgMinMaxLayerKernel::configure(), CpuIm2ColKernel::configure(), CLROIAlignLayerKernel::configure(), CpuGemmTranspose1xWKernel::configure(), CLFuseBatchNormalizationKernel::configure(), CLBatchNormalizationLayerKernel::configure(), CpuGemmLowpOffsetContributionOutputStageKernel::configure(), CpuLogits1DSoftmaxKernel< IS_LOG >::configure(), ClLogits1DNormKernel::configure(), CLCropResize::configure(), ClComplexMulKernel::configure(), CLComputeMeanVariance::configure(), ClGemmLowpMatrixBReductionKernel::configure(), CpuComplexMulKernel::configure(), NECropKernel::configure_output_shape(), arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), arm_compute::cpu::directconv3d_float_neon_ndhwc(), arm_compute::cpu::directconv3d_quantized_neon_ndhwc(), ClDirectConvolutionKernelComponent::get_window(), ClFloorKernelComponent::get_window(), ClElementwiseKernelComponent::get_window(), ClTemplateDirectConv2d::get_window(), intersect_valid_regions(), and arm_compute::cpu::kernels::validate_and_configure_window().

29 {
30  if(!skip_border)
31  {
32  border_size = BorderSize(0);
33  }
34 
35  const Coordinates &anchor = valid_region.anchor;
36  const TensorShape &shape = valid_region.shape;
37 
38  Window window;
39 
40  window.set(0, Window::Dimension(
41  // Skip the border left of the image
42  anchor[0] + border_size.left,
43  // Skip the border right of the image
44  // Make sure the window width is a multiple of the step size
45  anchor[0] + border_size.left + ceil_to_multiple(std::max(0, static_cast<int>(shape[0]) - static_cast<int>(border_size.left) - static_cast<int>(border_size.right)), steps[0]),
46  steps[0]));
47 
48  size_t n = 1;
49 
50  if(anchor.num_dimensions() > 1)
51  {
52  window.set(1, Window::Dimension(
53  // Skip the border above the image
54  anchor[1] + border_size.top,
55  // Skip the border below the image
56  anchor[1] + border_size.top + ceil_to_multiple(std::max(0, static_cast<int>(shape[1]) - static_cast<int>(border_size.top) - static_cast<int>(border_size.bottom)), steps[1]),
57  steps[1]));
58 
59  ++n;
60  }
61 
62  if(anchor.num_dimensions() > 2)
63  {
64  window.set(2, Window::Dimension(anchor[2], std::max<size_t>(1, shape[2]), steps[2]));
65 
66  ++n;
67  }
68 
69  for(; n < anchor.num_dimensions(); ++n)
70  {
71  window.set(n, Window::Dimension(anchor[n], std::max<size_t>(1, shape[n])));
72  }
73 
74  for(; n < Coordinates::num_max_dimensions; ++n)
75  {
76  window.set(n, Window::Dimension(0, 1));
77  }
78 
79  return window;
80 }
TensorShape shape
Shape of the valid region.
Definition: Types.h:266
const ValidRegion valid_region
Definition: Scale.cpp:214
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Definition: Utils.h:71
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:79
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:265

◆ calculate_max_window() [2/2]

Window arm_compute::calculate_max_window ( const TensorShape shape,
const Steps steps,
bool  skip_border,
BorderSize  border_size 
)

Definition at line 82 of file WindowHelpers.cpp.

References BorderSize::bottom, ceil_to_multiple(), BorderSize::left, arm_compute::test::validation::n, Dimensions< T >::num_dimensions(), Dimensions< int >::num_max_dimensions, BorderSize::right, Window::set(), and BorderSize::top.

83 {
84  if(!skip_border)
85  {
86  border_size = BorderSize(0);
87  }
88 
89  Window window;
90 
91  window.set(0, Window::Dimension(
92  // Skip the border left of the image
93  border_size.left,
94  // Skip the border right of the image
95  // Make sure the window width is a multiple of the step size
96  border_size.left + ceil_to_multiple(std::max(0, static_cast<int>(shape[0]) - static_cast<int>(border_size.left) - static_cast<int>(border_size.right)), steps[0]),
97  steps[0]));
98 
99  size_t n = 1;
100 
101  if(shape.num_dimensions() > 1)
102  {
103  window.set(1, Window::Dimension(
104  // Skip the border above the image
105  border_size.top,
106  // Skip the border below the image
107  border_size.top + ceil_to_multiple(std::max(0, static_cast<int>(shape[1]) - static_cast<int>(border_size.top) - static_cast<int>(border_size.bottom)), steps[1]),
108  steps[1]));
109 
110  ++n;
111  }
112 
113  if(shape.num_dimensions() > 2)
114  {
115  window.set(2, Window::Dimension(0, std::max<size_t>(1, shape[2]), steps[2]));
116 
117  ++n;
118  }
119 
120  for(; n < shape.num_dimensions(); ++n)
121  {
122  window.set(n, Window::Dimension(0, std::max<size_t>(1, shape[n])));
123  }
124 
125  for(; n < Coordinates::num_max_dimensions; ++n)
126  {
127  window.set(n, Window::Dimension(0, 1));
128  }
129 
130  return window;
131 }
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Definition: Utils.h:71

◆ calculate_max_window_horizontal()

Window arm_compute::calculate_max_window_horizontal ( const ValidRegion valid_region,
const Steps steps,
bool  skip_border,
BorderSize  border_size 
)

Definition at line 182 of file WindowHelpers.cpp.

References ValidRegion::anchor, BorderSize::bottom, ceil_to_multiple(), BorderSize::left, arm_compute::test::validation::n, Dimensions< T >::num_dimensions(), Dimensions< int >::num_max_dimensions, BorderSize::right, Window::set(), arm_compute::test::validation::shape, ValidRegion::shape, and BorderSize::top.

Referenced by CpuGemmLowpMatrixBReductionKernel::configure(), and intersect_valid_regions().

183 {
184  if(skip_border)
185  {
186  border_size.top = 0;
187  border_size.bottom = 0;
188  }
189  else
190  {
191  border_size.left = 0;
192  border_size.right = 0;
193  }
194 
195  const Coordinates &anchor = valid_region.anchor;
196  const TensorShape &shape = valid_region.shape;
197 
198  Window window;
199 
200  window.set(0, Window::Dimension(
201  // Skip the border left of the image
202  anchor[0] + border_size.left,
203  // Skip the border right of the image
204  // Make sure the window width is a multiple of the step size
205  anchor[0] + border_size.left + ceil_to_multiple(std::max(0, static_cast<int>(shape[0]) - static_cast<int>(border_size.left) - static_cast<int>(border_size.right)), steps[0]),
206  steps[0]));
207 
208  size_t n = 1;
209 
210  if(anchor.num_dimensions() > 1)
211  {
212  window.set(1, Window::Dimension(
213  // Skip the border above the image
214  anchor[1] - border_size.top,
215  // Skip the border below the image
216  anchor[1] + shape[1] + border_size.bottom,
217  1));
218 
219  ++n;
220  }
221 
222  for(; n < anchor.num_dimensions(); ++n)
223  {
224  window.set(n, Window::Dimension(anchor[n], std::max<size_t>(1, shape[n])));
225  }
226 
227  for(; n < Coordinates::num_max_dimensions; ++n)
228  {
229  window.set(n, Window::Dimension(0, 1));
230  }
231 
232  return window;
233 }
TensorShape shape
Shape of the valid region.
Definition: Types.h:266
const ValidRegion valid_region
Definition: Scale.cpp:214
auto ceil_to_multiple(S value, T divisor) -> decltype(((value+divisor - 1)/divisor) *divisor)
Computes the smallest number larger or equal to value that is a multiple of divisor.
Definition: Utils.h:71
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:79
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:265

◆ calculate_same_pad()

PadStrideInfo calculate_same_pad ( TensorShape  input_shape,
TensorShape  weights_shape,
PadStrideInfo  conv_info,
DataLayout  data_layout = DataLayout::NCHW,
const Size2D dilation = Size2D(1u, 1u),
const DimensionRoundingType rounding_type = DimensionRoundingType::FLOOR 
)

Calculate padding requirements in case of SAME padding.

Parameters
[in]input_shapeInput shape
[in]weights_shapeWeights shape
[in]conv_infoConvolution information (containing strides)
[in]data_layout(Optional) Data layout of the input and weights tensor
[in]dilation(Optional) Dilation factor used in the convolution.
[in]rounding_type(Optional) Dimension rounding type when down-scaling.
Returns
PadStrideInfo for SAME padding

Definition at line 367 of file Utils.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, CEIL, get_data_layout_dimension_index(), HEIGHT, scaled_dimensions(), PadStrideInfo::stride(), WIDTH, Size2D::x(), and Size2D::y().

Referenced by arm_compute::utils::calculate_convolution_padding(), and permute_strides().

369 {
370  const auto &strides = conv_info.stride();
371  ARM_COMPUTE_ERROR_ON_MSG((strides.first < 1 || strides.second < 1), "Stride values should be greater than or equal to 1.");
372 
373  const unsigned int width_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
374  const unsigned int height_idx = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
375  const unsigned int in_width = input_shape[width_idx];
376  const unsigned int in_height = input_shape[height_idx];
377  const unsigned int kernel_width = weights_shape[width_idx];
378  const unsigned int kernel_height = weights_shape[height_idx];
379 
380  // Calculate output dimensions
381  const auto is_ceil = static_cast<unsigned int>(rounding_type == DimensionRoundingType::CEIL);
382  const unsigned int out_width = ((in_width - is_ceil) + strides.first - 1) / strides.first + is_ceil;
383  const unsigned int out_height = ((in_height - is_ceil) + strides.second - 1) / strides.second + is_ceil;
384 
385  // Calculate effective weights sizes
386  const int real_weight_width = (kernel_width - 1) * dilation.x() + 1;
387  const int real_weight_height = (kernel_height - 1) * dilation.y() + 1;
388 
389  // Calculate total pad
390  const int pad_width = std::max(0, static_cast<int>((out_width - 1) * strides.first + real_weight_width - in_width));
391  const int pad_height = std::max(0, static_cast<int>((out_height - 1) * strides.second + real_weight_height - in_height));
392 
393  // Calculate individual paddings
394  const unsigned int pad_left = pad_width / 2;
395  const unsigned int pad_top = pad_height / 2;
396  const unsigned int pad_right = pad_width - pad_left;
397  const unsigned int pad_bottom = pad_height - pad_top;
398 
399  PadStrideInfo same_info(strides.first, strides.second, pad_left, pad_right, pad_top, pad_bottom, rounding_type);
400 
401  // Check for correctness of predicted output shape against the one calculated using the generated info
402  const auto out_dims = scaled_dimensions(in_width, in_height, kernel_width, kernel_height, same_info, dilation);
403  ARM_COMPUTE_ERROR_ON(out_dims.first != out_width || out_dims.second != out_height);
404  ARM_COMPUTE_UNUSED(out_dims);
405 
406  return same_info;
407 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode...
Definition: Utils.cpp:429
const auto input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193

◆ calculate_squashed_or_max_window() [1/2]

std::pair<Window, size_t> arm_compute::calculate_squashed_or_max_window ( const ITensorInfo src0,
const ITensorInfo src1 
)

Definition at line 235 of file WindowHelpers.cpp.

References Window::DimX, Window::DimY, ITensorInfo::element_size(), ITensorInfo::num_dimensions(), Dimensions< int >::num_max_dimensions, ITensorInfo::strides_in_bytes(), and ITensorInfo::tensor_shape().

Referenced by CpuActivationKernel::configure(), CpuSubKernel::configure(), CpuMulKernel::configure(), CpuAddKernel::configure(), and intersect_valid_regions().

236 {
237  const auto &shape0 = src0.tensor_shape();
238  const auto &shape1 = src1.tensor_shape();
239  const auto &strides0 = src0.strides_in_bytes();
240  const auto &strides1 = src1.strides_in_bytes();
241  const auto num_dimensions = std::max(src0.num_dimensions(), src1.num_dimensions());
242 
243  Window win;
244  size_t split_dimension = Window::DimY;
245  size_t dim = 0;
246 
247  size_t squashed_bytes = src0.element_size();
248 
249  // Try to squash the low dimensions together.
250  for(; dim < num_dimensions; ++dim)
251  {
252  if(shape0[dim] != shape1[dim] || strides0[dim] != squashed_bytes || strides1[dim] != squashed_bytes)
253  {
254  break;
255  }
256 
257  squashed_bytes *= shape0[dim];
258  }
259 
260  if(dim == num_dimensions)
261  {
262  auto squashed_elements = squashed_bytes / src0.element_size();
263 
264  split_dimension = Window::DimX;
265 
266  // The input tensors can be interpreted as 1D array.
267  win.set(0, Window::Dimension(0, squashed_elements, 1));
268 
269  for(dim = 1; dim < Coordinates::num_max_dimensions; ++dim)
270  {
271  win.set(dim, Window::Dimension(0, 1, 1));
272  }
273  }
274  else
275  {
276  // Generates the max window.
277  for(dim = 0; dim < Coordinates::num_max_dimensions; ++dim)
278  {
279  win.set(dim, Window::Dimension(0, std::max(shape0[dim], shape1[dim]), 1));
280  }
281  }
282 
283  return std::make_pair(win, split_dimension);
284 }

◆ calculate_squashed_or_max_window() [2/2]

std::pair<Window, size_t> arm_compute::calculate_squashed_or_max_window ( const ITensorInfo src)

Definition at line 286 of file WindowHelpers.cpp.

References Window::DimX, Window::DimY, ITensorInfo::element_size(), ITensorInfo::num_dimensions(), Dimensions< int >::num_max_dimensions, Window::set(), arm_compute::test::validation::shape, ITensorInfo::strides_in_bytes(), and ITensorInfo::tensor_shape().

287 {
288  const auto &shape = src.tensor_shape();
289  const auto &strides = src.strides_in_bytes();
290  const auto num_dimensions = src.num_dimensions();
291 
292  Window win;
293  size_t split_dimension = Window::DimY;
294  size_t dim = 0;
295  size_t squashed_bytes = src.element_size();
296 
297  // Try to squash the low dimensions together.
298  for(; dim < num_dimensions; ++dim)
299  {
300  if(strides[dim] != squashed_bytes)
301  {
302  break;
303  }
304  squashed_bytes *= shape[dim];
305  }
306  if(dim == num_dimensions)
307  {
308  const auto squashed_elements = squashed_bytes / src.element_size();
309  split_dimension = Window::DimX;
310  // The input tensor can be interpreted as 1D array.
311  win.set(0, Window::Dimension(0, squashed_elements, 1));
312  for(dim = 1; dim < Coordinates::num_max_dimensions; ++dim)
313  {
314  win.set(dim, Window::Dimension(0, 1, 1));
315  }
316  }
317  else
318  {
319  // Generate the max window.
320  for(dim = 0; dim < Coordinates::num_max_dimensions; ++dim)
321  {
322  win.set(dim, Window::Dimension(0, shape[dim], 1));
323  }
324  }
325  return std::make_pair(win, split_dimension);
326 }
SimpleTensor< float > src
Definition: DFT.cpp:155

◆ calculate_subsampled_shape()

TensorShape arm_compute::calculate_subsampled_shape ( const TensorShape shape,
Format  format,
Channel  channel = Channel::UNKNOWN 
)
inline

Calculate subsampled shape for a given format and channel.

Parameters
[in]shapeShape of the tensor to calculate the extracted channel.
[in]formatFormat of the tensor.
[in]channelChannel to create tensor shape to be extracted.
Returns
The subsampled tensor shape.

Definition at line 698 of file Utils.h.

References has_format_horizontal_subsampling(), has_format_vertical_subsampling(), TensorShape::set(), arm_compute::utils::cast::U, U, UNKNOWN, and V.

Referenced by error_on_tensors_not_subsampled().

699 {
700  TensorShape output{ shape };
701 
702  // Subsample shape only for U or V channel
703  if(Channel::U == channel || Channel::V == channel || Channel::UNKNOWN == channel)
704  {
705  // Subsample width for the tensor shape when channel is U or V
707  {
708  output.set(0, output.x() / 2U);
709  }
710 
711  // Subsample height for the tensor shape when channel is U or V
713  {
714  output.set(1, output.y() / 2U);
715  }
716  }
717 
718  return output;
719 }
bool has_format_vertical_subsampling(Format format)
Return true if the given format has vertical subsampling.
Definition: Utils.h:653
Unknown CL kernel type.
Definition: CLTypes.h:82
bool has_format_horizontal_subsampling(Format format)
Return true if the given format has horizontal subsampling.
Definition: Utils.h:642

◆ calculate_valid_region_scale()

ValidRegion calculate_valid_region_scale ( const ITensorInfo src_info,
const TensorShape dst_shape,
InterpolationPolicy  interpolate_policy,
SamplingPolicy  sampling_policy,
bool  border_undefined 
)

Helper function to calculate the Valid Region for Scale.

Parameters
[in]src_infoInput tensor info used to check.
[in]dst_shapeShape of the output.
[in]interpolate_policyInterpolation policy.
[in]sampling_policySampling policy.
[in]border_undefinedTrue if the border is undefined.
Returns
The corresponding valid region

Definition at line 28 of file Helpers.cpp.

References ValidRegion::anchor, AREA, ARM_COMPUTE_ERROR, BILINEAR, CENTER, ITensorInfo::data_layout(), arm_compute::test::validation::data_layout, arm_compute::test::validation::dst_shape, get_data_layout_dimension_index(), HEIGHT, arm_compute::test::validation::idx_height, arm_compute::test::validation::idx_width, NEAREST_NEIGHBOR, Dimensions< T >::num_dimensions(), arm_compute::test::validation::scale_x, arm_compute::test::validation::scale_y, Dimensions< T >::set(), TensorShape::set(), ValidRegion::shape, ITensorInfo::tensor_shape(), arm_compute::test::validation::valid_region, ITensorInfo::valid_region(), and WIDTH.

Referenced by arm_compute::test::validation::FIXTURE_DATA_TEST_CASE(), and permute().

30 {
32  const int idx_width = get_data_layout_dimension_index(data_layout, DataLayoutDimension::WIDTH);
33  const int idx_height = get_data_layout_dimension_index(data_layout, DataLayoutDimension::HEIGHT);
34 
35  const float scale_x = static_cast<float>(dst_shape[idx_width]) / src_info.tensor_shape()[idx_width];
36  const float scale_y = static_cast<float>(dst_shape[idx_height]) / src_info.tensor_shape()[idx_height];
37  const float sampling_point = (sampling_policy == SamplingPolicy::CENTER) ? 0.5f : 0.0f;
38 
39  // Get input's valid region start and end points
40  const int valid_start_in_x = src_info.valid_region().anchor[idx_width];
41  const int valid_start_in_y = src_info.valid_region().anchor[idx_height];
42  const int valid_end_in_x = src_info.valid_region().anchor[idx_width] + src_info.valid_region().shape[idx_width];
43  const int valid_end_in_y = src_info.valid_region().anchor[idx_height] + src_info.valid_region().shape[idx_height];
44 
45  // Initialize output's valid region start and end points
46  auto valid_start_out_x = static_cast<int>(valid_start_in_x * scale_x);
47  auto valid_start_out_y = static_cast<int>(valid_start_in_y * scale_y);
48  auto valid_end_out_x = std::min<int>(std::ceil(valid_end_in_x * scale_x), dst_shape[idx_width]);
49  auto valid_end_out_y = std::min<int>(std::ceil(valid_end_in_y * scale_y), dst_shape[idx_height]);
50 
51  // Handle valid points in case of the bi-linear interpolation
52  if(border_undefined)
53  {
54  switch(interpolate_policy)
55  {
56  case InterpolationPolicy::NEAREST_NEIGHBOR:
57  {
58  // (start_out + sampling_point) >= (start_in * scale)
59  // start_out = ceil((start_in * scale) - sampling_point)
60  valid_start_out_x = std::ceil(valid_start_in_x * scale_x - sampling_point);
61  valid_start_out_y = std::ceil(valid_start_in_y * scale_y - sampling_point);
62 
63  // (end_out - 1 + sampling_point) < (end_in * scale)
64  // end_out = ceil((end_in * scale) - sampling_point); // <-- ceil(x - 1) strictly less
65  valid_end_out_x = std::ceil(valid_end_in_x * scale_x - sampling_point);
66  valid_end_out_y = std::ceil(valid_end_in_y * scale_y - sampling_point);
67  break;
68  }
69  case InterpolationPolicy::BILINEAR:
70  {
71  // (start_out + sampling_point) >= ((start_in + sampling_point) * scale)
72  // start_out = ceil(((start_in + sampling_point) * scale) - sampling_point)
73  valid_start_out_x = std::ceil((valid_start_in_x + sampling_point) * scale_x - sampling_point);
74  valid_start_out_y = std::ceil((valid_start_in_y + sampling_point) * scale_y - sampling_point);
75 
76  // (end_out - 1 + sampling_point) <= ((end_in - 1 + sampling_point) * scale)
77  // end_out = floor(((end_in - 1 + sampling_point) * scale) - sampling_point + 1)
78  valid_end_out_x = std::floor((valid_end_in_x - 1.f + sampling_point) * scale_x - sampling_point + 1.f);
79  valid_end_out_y = std::floor((valid_end_in_y - 1.f + sampling_point) * scale_y - sampling_point + 1.f);
80  break;
81  }
82  case InterpolationPolicy::AREA:
83  break;
84  default:
85  {
86  ARM_COMPUTE_ERROR("Invalid InterpolationPolicy");
87  break;
88  }
89  }
90  }
91 
92  // Setup output valid region
93  ValidRegion valid_region{ Coordinates(), dst_shape, dst_shape.num_dimensions() };
94 
95  valid_region.anchor.set(idx_width, std::max(0, valid_start_out_x));
96  valid_region.anchor.set(idx_height, std::max(0, valid_start_out_y));
97 
98  valid_region.shape.set(idx_width, std::min<size_t>(valid_end_out_x - valid_start_out_x, dst_shape[idx_width]));
99  valid_region.shape.set(idx_height, std::min<size_t>(valid_end_out_y - valid_start_out_y, dst_shape[idx_height]));
100 
101  return valid_region;
102 }
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: Dimensions.h:76
TensorShape shape
Shape of the valid region.
Definition: Types.h:266
ValidRegion valid_region() const override
Valid region of the tensor.
Definition: TensorInfo.h:279
DataLayout data_layout() const override
Get the data layout of the tensor.
Definition: TensorInfo.h:291
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
const ValidRegion valid_region
Definition: Scale.cpp:214
TensorInfo src_info(src_shape, 1, data_type)
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
Definition: Dimensions.h:143
const TensorShape & tensor_shape() const override
Size for each dimension of the tensor.
Definition: TensorInfo.h:234
DataLayout
[DataLayout enum definition]
Definition: Types.h:113
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Definition: TensorShape.h:79
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:265

◆ ceil_to_multiple()

auto arm_compute::ceil_to_multiple ( value,
divisor 
) -> decltype(((value + divisor - 1) / divisor) * divisor)
inline

Computes the smallest number larger or equal to value that is a multiple of divisor.

Parameters
[in]valueLower bound value
[in]divisorValue to compute multiple of.
Returns
the result.

Definition at line 71 of file Utils.h.

References ARM_COMPUTE_ERROR_ON, and DIV_CEIL().

Referenced by calculate_max_enlarged_window(), calculate_max_window(), calculate_max_window_horizontal(), ClDequantizeKernel::configure(), ClElementWiseUnaryKernel::configure(), ClFillKernel::configure(), ClCopyKernel::configure(), ClQuantizeKernel::configure(), CLStridedSliceKernel::configure(), ClCropKernel::configure(), CLTileKernel::configure(), CLPadLayerKernel::configure(), ClDirectConvolutionKernelComponent::get_window(), ClTemplateDirectConv2d::get_window(), arm_compute::opencl::kernels::gemm::is_mmul_kernel_preferred(), ClCropKernel::run_op(), CpuGemmLowpMatrixMultiplyKernel::run_op(), ClDirectConv3dKernel::run_op(), ClIm2ColKernel::run_op(), Window::scale(), CpuGemmLowpMatrixBReductionKernel::validate(), and arm_compute::cpu::vector_matrix_multiply_f32().

72 {
73  ARM_COMPUTE_ERROR_ON(value < 0 || divisor <= 0);
74  return DIV_CEIL(value, divisor) * divisor;
75 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
constexpr auto DIV_CEIL(S val, T m) -> decltype((val+m - 1)/m)
Calculate the rounded up quotient of val / m.
Definition: Utils.h:58

◆ channel_idx_from_format()

int arm_compute::channel_idx_from_format ( Format  format,
Channel  channel 
)
inline

Return the channel index of a given channel given an input format.

Parameters
[in]formatInput format
[in]channelInput channel
Returns
The channel index of the specific channel of the specific format

Definition at line 327 of file Utils.h.

References A, ARM_COMPUTE_ERROR, B, G, IYUV, NV12, NV21, R, RGB888, RGBA8888, U, UYVY422, V, Y, YUV444, and YUYV422.

328 {
329  switch(format)
330  {
331  case Format::RGB888:
332  {
333  switch(channel)
334  {
335  case Channel::R:
336  return 0;
337  case Channel::G:
338  return 1;
339  case Channel::B:
340  return 2;
341  default:
342  ARM_COMPUTE_ERROR("Not supported channel");
343  return 0;
344  }
345  }
346  case Format::RGBA8888:
347  {
348  switch(channel)
349  {
350  case Channel::R:
351  return 0;
352  case Channel::G:
353  return 1;
354  case Channel::B:
355  return 2;
356  case Channel::A:
357  return 3;
358  default:
359  ARM_COMPUTE_ERROR("Not supported channel");
360  return 0;
361  }
362  }
363  case Format::YUYV422:
364  {
365  switch(channel)
366  {
367  case Channel::Y:
368  return 0;
369  case Channel::U:
370  return 1;
371  case Channel::V:
372  return 3;
373  default:
374  ARM_COMPUTE_ERROR("Not supported channel");
375  return 0;
376  }
377  }
378  case Format::UYVY422:
379  {
380  switch(channel)
381  {
382  case Channel::Y:
383  return 1;
384  case Channel::U:
385  return 0;
386  case Channel::V:
387  return 2;
388  default:
389  ARM_COMPUTE_ERROR("Not supported channel");
390  return 0;
391  }
392  }
393  case Format::NV12:
394  {
395  switch(channel)
396  {
397  case Channel::Y:
398  return 0;
399  case Channel::U:
400  return 0;
401  case Channel::V:
402  return 1;
403  default:
404  ARM_COMPUTE_ERROR("Not supported channel");
405  return 0;
406  }
407  }
408  case Format::NV21:
409  {
410  switch(channel)
411  {
412  case Channel::Y:
413  return 0;
414  case Channel::U:
415  return 1;
416  case Channel::V:
417  return 0;
418  default:
419  ARM_COMPUTE_ERROR("Not supported channel");
420  return 0;
421  }
422  }
423  case Format::YUV444:
424  case Format::IYUV:
425  {
426  switch(channel)
427  {
428  case Channel::Y:
429  return 0;
430  case Channel::U:
431  return 0;
432  case Channel::V:
433  return 0;
434  default:
435  ARM_COMPUTE_ERROR("Not supported channel");
436  return 0;
437  }
438  }
439  default:
440  ARM_COMPUTE_ERROR("Not supported format");
441  return 0;
442  }
443 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ check_value_range()

bool arm_compute::check_value_range ( val,
DataType  dt,
QuantizationInfo  qinfo = QuantizationInfo() 
)

Returns true if the value can be represented by the given data type.

Parameters
[in]valvalue to be checked
[in]dtdata type that is checked
[in]qinfo(Optional) quantization info if the data type is QASYMM8
Returns
true if the data type can hold the value.

Definition at line 1161 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, dequantize_qasymm8(), F16, F32, bfloat16::lowest(), arm_compute::support::cpp11::lowest(), bfloat16::max(), QASYMM8, arm_compute::test::validation::qinfo, S16, S32, S8, U16, U32, and U8.

1162 {
1163  switch(dt)
1164  {
1165  case DataType::U8:
1166  {
1167  const auto val_u8 = static_cast<uint8_t>(val);
1168  return ((val_u8 == val) && val >= std::numeric_limits<uint8_t>::lowest() && val <= std::numeric_limits<uint8_t>::max());
1169  }
1170  case DataType::QASYMM8:
1171  {
1172  double min = static_cast<double>(dequantize_qasymm8(0, qinfo));
1173  double max = static_cast<double>(dequantize_qasymm8(std::numeric_limits<uint8_t>::max(), qinfo));
1174  return ((double)val >= min && (double)val <= max);
1175  }
1176  case DataType::S8:
1177  {
1178  const auto val_s8 = static_cast<int8_t>(val);
1179  return ((val_s8 == val) && val >= std::numeric_limits<int8_t>::lowest() && val <= std::numeric_limits<int8_t>::max());
1180  }
1181  case DataType::U16:
1182  {
1183  const auto val_u16 = static_cast<uint16_t>(val);
1184  return ((val_u16 == val) && val >= std::numeric_limits<uint16_t>::lowest() && val <= std::numeric_limits<uint16_t>::max());
1185  }
1186  case DataType::S16:
1187  {
1188  const auto val_s16 = static_cast<int16_t>(val);
1189  return ((val_s16 == val) && val >= std::numeric_limits<int16_t>::lowest() && val <= std::numeric_limits<int16_t>::max());
1190  }
1191  case DataType::U32:
1192  {
1193  const auto val_d64 = static_cast<double>(val);
1194  const auto val_u32 = static_cast<uint32_t>(val);
1195  return ((val_u32 == val_d64) && val_d64 >= std::numeric_limits<uint32_t>::lowest() && val_d64 <= std::numeric_limits<uint32_t>::max());
1196  }
1197  case DataType::S32:
1198  {
1199  const auto val_d64 = static_cast<double>(val);
1200  const auto val_s32 = static_cast<int32_t>(val);
1201  return ((val_s32 == val_d64) && val_d64 >= std::numeric_limits<int32_t>::lowest() && val_d64 <= std::numeric_limits<int32_t>::max());
1202  }
1203  case DataType::BFLOAT16:
1204  return (val >= bfloat16::lowest() && val <= bfloat16::max());
1205  case DataType::F16:
1206  return (val >= std::numeric_limits<half>::lowest() && val <= std::numeric_limits<half>::max());
1207  case DataType::F32:
1208  return (val >= std::numeric_limits<float>::lowest() && val <= std::numeric_limits<float>::max());
1209  default:
1210  ARM_COMPUTE_ERROR("Data type not supported");
1211  return false;
1212  }
1213 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
float dequantize_qasymm8(uchar input, float offset, float scale)
Dequantize a scalar value from 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:62
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ cl_winograd_convolution_layer_supported()

bool cl_winograd_convolution_layer_supported ( const Size2D output_tile,
const Size2D kernel_size,
DataLayout  data_layout 
)

This function checks if the Winograd configuration (defined through the output tile, kernel size and the data layout) is supported on OpenCL.

Parameters
[in]output_tileOutput tile for the Winograd filtering algorithm
[in]kernel_sizeKernel size for the Winograd filtering algorithm
[in]data_layoutData layout of the input tensor
Returns
True if the configuration is supported

Definition at line 290 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR_ON, Size2D::height, NCHW, UNKNOWN, and Size2D::width.

291 {
293 
294  using WinogradConfiguration = std::pair<std::pair<int, int>, std::pair<int, int>>;
295 
296  std::vector<WinogradConfiguration> winograd_configs_nchw =
297  {
298  WinogradConfiguration(std::pair<int, int>(1, 2), std::pair<int, int>(1, 3)),
299  WinogradConfiguration(std::pair<int, int>(1, 4), std::pair<int, int>(1, 3)),
300  WinogradConfiguration(std::pair<int, int>(2, 1), std::pair<int, int>(3, 1)),
301  WinogradConfiguration(std::pair<int, int>(4, 1), std::pair<int, int>(3, 1)),
302  WinogradConfiguration(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3)),
303  WinogradConfiguration(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3)),
304  WinogradConfiguration(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5)),
305  WinogradConfiguration(std::pair<int, int>(4, 1), std::pair<int, int>(5, 1)),
306  WinogradConfiguration(std::pair<int, int>(1, 4), std::pair<int, int>(1, 5))
307  };
308 
309  std::vector<WinogradConfiguration> winograd_configs_nhwc =
310  {
311  WinogradConfiguration(std::pair<int, int>(2, 2), std::pair<int, int>(3, 3)),
312  WinogradConfiguration(std::pair<int, int>(1, 4), std::pair<int, int>(1, 3)),
313  WinogradConfiguration(std::pair<int, int>(4, 1), std::pair<int, int>(3, 1)),
314  WinogradConfiguration(std::pair<int, int>(4, 4), std::pair<int, int>(3, 3)),
315  WinogradConfiguration(std::pair<int, int>(4, 4), std::pair<int, int>(5, 5)),
316  WinogradConfiguration(std::pair<int, int>(4, 1), std::pair<int, int>(5, 1)),
317  WinogradConfiguration(std::pair<int, int>(1, 4), std::pair<int, int>(1, 5)),
318  WinogradConfiguration(std::pair<int, int>(1, 2), std::pair<int, int>(1, 7)),
319  WinogradConfiguration(std::pair<int, int>(2, 1), std::pair<int, int>(7, 1)),
320  WinogradConfiguration(std::pair<int, int>(2, 2), std::pair<int, int>(7, 7)),
321  };
322 
323  auto p = std::make_pair(std::pair<int, int>(output_tile.width, output_tile.height),
324  std::pair<int, int>(kernel_size.width, kernel_size.height));
325 
326  // Return true if supported
327  if(data_layout == DataLayout::NCHW)
328  {
329  return (std::find(winograd_configs_nchw.begin(), winograd_configs_nchw.end(), p) != winograd_configs_nchw.end());
330  }
331  else
332  {
333  return (std::find(winograd_configs_nhwc.begin(), winograd_configs_nhwc.end(), p) != winograd_configs_nhwc.end());
334  }
335 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466

◆ colorconvert_iyuv_to_nv12()

void arm_compute::colorconvert_iyuv_to_nv12 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert IYUV to NV12.

Parameters
[in]inputInput IYUV data buffer.
[out]outputOutput NV12 buffer.
[in]winWindow for iterating the buffers.

Definition at line 658 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

659 {
660  ARM_COMPUTE_ERROR_ON(nullptr == input);
661  ARM_COMPUTE_ERROR_ON(nullptr == output);
662  win.validate();
663 
664  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
665  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
666 
667  // UV's width and height are subsampled
668  Window win_uv(win);
669  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
670  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
671  win_uv.validate();
672 
673  Iterator in_y(input_ptr->plane(0), win);
674  Iterator in_u(input_ptr->plane(1), win_uv);
675  Iterator in_v(input_ptr->plane(2), win_uv);
676  Iterator out_y(output_ptr->plane(0), win);
677  Iterator out_uv(output_ptr->plane(1), win_uv);
678 
679  execute_window_loop(win, [&](const Coordinates &)
680  {
681  const auto ta_y_top = vld2q_u8(in_y.ptr());
682  const auto ta_y_bottom = vld2q_u8(in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y());
683  uint8x16x2_t ta_uv;
684  ta_uv.val[0] = vld1q_u8(in_u.ptr());
685  ta_uv.val[1] = vld1q_u8(in_v.ptr());
686  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
687  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
688  //ta_uv.val[0] = U0 U2 U4 U6 ...
689  //ta_uv.val[1] = V0 V2 V4 V6 ...
690 
691  vst2q_u8(out_y.ptr(), ta_y_top);
692  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), ta_y_bottom);
693  vst2q_u8(out_uv.ptr(), ta_uv);
694  },
695  in_y, in_u, in_v, out_y, out_uv);
696 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_iyuv_to_rgb()

void arm_compute::colorconvert_iyuv_to_rgb ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert IYUV to RGB.

Parameters
[in]inputInput IYUV data buffer.
[out]outputOutput RGB buffer.
[in]winWindow for iterating the buffers.

Definition at line 517 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, convert_uint8x16_to_float32x4x4(), Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), ITensor::info(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), ITensorInfo::strides_in_bytes(), Window::validate(), Window::x(), Dimensions< T >::y(), Window::y(), and arm_compute::test::colorconvert_helper::detail::yuyv_to_rgb_calculation().

518 {
519  ARM_COMPUTE_ERROR_ON(nullptr == input);
520  ARM_COMPUTE_ERROR_ON(nullptr == output);
521  win.validate();
522 
523  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
524  const auto output_ptr = static_cast<IImage *__restrict>(output);
525 
526  constexpr auto element_size = alpha ? 32 : 24;
527  const auto out_stride = output_ptr->info()->strides_in_bytes().y();
528 
529  // UV's width and height are subsampled
530  Window win_uv(win);
531  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
532  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
533  win_uv.validate();
534 
535  Iterator in_y(input_ptr->plane(0), win);
536  Iterator in_u(input_ptr->plane(1), win_uv);
537  Iterator in_v(input_ptr->plane(2), win_uv);
538  Iterator out(output_ptr, win);
539 
540  execute_window_loop(win, [&](const Coordinates &)
541  {
542  const auto *y_top_ptr = in_y.ptr();
543  const auto *y_bottom_ptr = in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y();
544  const auto *u_ptr = in_u.ptr();
545  const auto *v_ptr = in_v.ptr();
546 
547  // Work-around issue in gcc 9(>=) where vld2q might cause issues with register allocation
548 #if defined(__arch64__)
549  const auto ta0_y_top = vld1q_u8(y_top_ptr);
550  const auto ta1_y_top = vld1q_u8(y_top_ptr + 16);
551  const auto ta0_y_bottom = vld1q_u8(y_bottom_ptr);
552  const auto ta1_y_bottom = vld1q_u8(y_bottom_ptr + 16);
553  const auto ta_u = vld1q_u8(u_ptr);
554  const auto ta_v = vld1q_u8(v_ptr);
555 
556  // Convert the uint8x16x4_t to float32x4x4_t
557  float32x4x4_t yvec_top = arm_compute::convert_uint8x16_to_float32x4x4(vuzp1q_u8(ta0_y_top, ta1_y_top));
558  float32x4x4_t yyvec_top = arm_compute::convert_uint8x16_to_float32x4x4(vuzp2q_u8(ta0_y_top, ta1_y_top));
559  float32x4x4_t yvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(vuzp1q_u8(ta0_y_bottom, ta1_y_bottom));
560  float32x4x4_t yyvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(vuzp2q_u8(ta0_y_bottom, ta1_y_bottom));
561  float32x4x4_t uvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_u);
562  float32x4x4_t vvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_v);
563 #else /* defined(__arch64__) */
564  const auto ta_y_top = vld2q_u8(y_top_ptr);
565  const auto ta_y_bottom = vld2q_u8(y_bottom_ptr);
566  const auto ta_u = vld1q_u8(u_ptr);
567  const auto ta_v = vld1q_u8(v_ptr);
568  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
569  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
570  //ta_u.val[0] = U0 U2 U4 U6 ...
571  //ta_v.val[0] = V0 V2 V4 V6 ...
572 
573  // Convert the uint8x16x4_t to float32x4x4_t
574  float32x4x4_t yvec_top = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_top.val[0]);
575  float32x4x4_t yyvec_top = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_top.val[1]);
576  float32x4x4_t yvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_bottom.val[0]);
577  float32x4x4_t yyvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_bottom.val[1]);
578  float32x4x4_t uvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_u);
579  float32x4x4_t vvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_v);
580 #endif /* defined(__arch64__) */
581 
582  yuyv_to_rgb_calculation(yvec_top.val[0], uvec.val[0], yyvec_top.val[0], vvec.val[0], out.ptr() + 0 * element_size, alpha);
583  yuyv_to_rgb_calculation(yvec_top.val[1], uvec.val[1], yyvec_top.val[1], vvec.val[1], out.ptr() + 1 * element_size, alpha);
584  yuyv_to_rgb_calculation(yvec_top.val[2], uvec.val[2], yyvec_top.val[2], vvec.val[2], out.ptr() + 2 * element_size, alpha);
585  yuyv_to_rgb_calculation(yvec_top.val[3], uvec.val[3], yyvec_top.val[3], vvec.val[3], out.ptr() + 3 * element_size, alpha);
586 
587  yuyv_to_rgb_calculation(yvec_bottom.val[0], uvec.val[0], yyvec_bottom.val[0], vvec.val[0], out.ptr() + out_stride + 0 * element_size, alpha);
588  yuyv_to_rgb_calculation(yvec_bottom.val[1], uvec.val[1], yyvec_bottom.val[1], vvec.val[1], out.ptr() + out_stride + 1 * element_size, alpha);
589  yuyv_to_rgb_calculation(yvec_bottom.val[2], uvec.val[2], yyvec_bottom.val[2], vvec.val[2], out.ptr() + out_stride + 2 * element_size, alpha);
590  yuyv_to_rgb_calculation(yvec_bottom.val[3], uvec.val[3], yyvec_bottom.val[3], vvec.val[3], out.ptr() + out_stride + 3 * element_size, alpha);
591  },
592  in_y, in_u, in_v, out);
593 }
float32x4x4_t convert_uint8x16_to_float32x4x4(const uint8x16_t &in)
Converts from uint8x16 to float32x4x4_t.
Definition: NEMath.inl:362
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void yuyv_to_rgb_calculation(const SimpleTensor< T > yvec, const SimpleTensor< T > vvec, const SimpleTensor< T > yyvec, const SimpleTensor< T > uvec, SimpleTensor< T > &dst)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77
T y() const
Alias to access the size of the second dimension.
Definition: Dimensions.h:92
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.

◆ colorconvert_iyuv_to_yuv4()

void arm_compute::colorconvert_iyuv_to_yuv4 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert IYUV to YUV4.

Parameters
[in]inputInput IYUV data buffer.
[out]outputOutput YUV4 buffer.
[in]winWindow for iterating the buffers.

Definition at line 873 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

874 {
875  ARM_COMPUTE_ERROR_ON(nullptr == input);
876  ARM_COMPUTE_ERROR_ON(nullptr == output);
877  win.validate();
878 
879  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
880  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
881 
882  // UV's width and height are subsampled
883  Window win_uv(win);
884  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
885  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
886  win_uv.validate();
887 
888  Iterator in_y(input_ptr->plane(0), win);
889  Iterator in_u(input_ptr->plane(1), win_uv);
890  Iterator in_v(input_ptr->plane(2), win_uv);
891  Iterator out_y(output_ptr->plane(0), win);
892  Iterator out_u(output_ptr->plane(1), win);
893  Iterator out_v(output_ptr->plane(2), win);
894 
895  execute_window_loop(win, [&](const Coordinates &)
896  {
897  const auto ta_y_top = vld2q_u8(in_y.ptr());
898  const auto ta_y_bottom = vld2q_u8(in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y());
899  const auto ta_u = vld1q_u8(in_u.ptr());
900  const auto ta_v = vld1q_u8(in_v.ptr());
901  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
902  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
903  //ta_u = U0 U2 U4 U6 ...
904  //ta_v = V0 V2 V4 V6 ...
905 
906  vst2q_u8(out_y.ptr(), ta_y_top);
907  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), ta_y_bottom);
908 
909  uint8x16x2_t uvec;
910  uvec.val[0] = ta_u;
911  uvec.val[1] = ta_u;
912  vst2q_u8(out_u.ptr(), uvec);
913  vst2q_u8(out_u.ptr() + output_ptr->plane(1)->info()->strides_in_bytes().y(), uvec);
914 
915  uint8x16x2_t vvec;
916  vvec.val[0] = ta_v;
917  vvec.val[1] = ta_v;
918  vst2q_u8(out_v.ptr(), vvec);
919  vst2q_u8(out_v.ptr() + output_ptr->plane(2)->info()->strides_in_bytes().y(), vvec);
920  },
921  in_y, in_u, in_v, out_y, out_u, out_v);
922 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_nv12_to_iyuv()

void arm_compute::colorconvert_nv12_to_iyuv ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert NV12 to IYUV.

Parameters
[in]inputInput NV12 data buffer.
[out]outputOutput IYUV buffer.
[in]winWindow for iterating the buffers.

Definition at line 706 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

707 {
708  ARM_COMPUTE_ERROR_ON(nullptr == input);
709  ARM_COMPUTE_ERROR_ON(nullptr == output);
710  win.validate();
711 
712  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
713  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
714 
715  constexpr auto shift = uv ? 0 : 1;
716 
717  // UV's width and height are subsampled
718  Window win_uv(win);
719  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
720  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
721  win_uv.validate();
722 
723  Iterator in_y(input_ptr->plane(0), win);
724  Iterator in_uv(input_ptr->plane(1), win_uv);
725  Iterator out_y(output_ptr->plane(0), win);
726  Iterator out_u(output_ptr->plane(1), win_uv);
727  Iterator out_v(output_ptr->plane(2), win_uv);
728 
729  execute_window_loop(win, [&](const Coordinates &)
730  {
731  const auto ta_y_top = vld2q_u8(in_y.ptr());
732  const auto ta_y_bottom = vld2q_u8(in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y());
733  const auto ta_uv = vld2q_u8(in_uv.ptr());
734  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
735  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
736  //ta_uv.val[0] = U0 U2 U4 U6 ...
737  //ta_uv.val[1] = V0 V2 V4 V6 ...
738 
739  vst2q_u8(out_y.ptr(), ta_y_top);
740  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), ta_y_bottom);
741  vst1q_u8(out_u.ptr(), ta_uv.val[0 + shift]);
742  vst1q_u8(out_v.ptr(), ta_uv.val[1 - shift]);
743  },
744  in_y, in_uv, out_y, out_u, out_v);
745 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_nv12_to_rgb()

void arm_compute::colorconvert_nv12_to_rgb ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert NV12 to RGB.

Parameters
[in]inputInput NV12 data buffer.
[out]outputOutput RGB buffer.
[in]winWindow for iterating the buffers.

Definition at line 455 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, convert_uint8x16_to_float32x4x4(), Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), ITensor::info(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), ITensorInfo::strides_in_bytes(), Window::validate(), Window::x(), Dimensions< T >::y(), Window::y(), and arm_compute::test::colorconvert_helper::detail::yuyv_to_rgb_calculation().

456 {
457  ARM_COMPUTE_ERROR_ON(nullptr == input);
458  ARM_COMPUTE_ERROR_ON(nullptr == output);
459  win.validate();
460 
461  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
462  const auto output_ptr = static_cast<IImage *__restrict>(output);
463 
464  constexpr auto element_size = alpha ? 32 : 24;
465  const auto out_stride = output_ptr->info()->strides_in_bytes().y();
466  constexpr auto shift = uv ? 0 : 1;
467 
468  // UV's width and height are subsampled
469  Window win_uv(win);
470  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win.x().step() / 2));
471  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
472  win_uv.validate();
473 
474  Iterator in_y(input_ptr->plane(0), win);
475  Iterator in_uv(input_ptr->plane(1), win_uv);
476  Iterator out(output_ptr, win);
477 
478  execute_window_loop(win, [&](const Coordinates &)
479  {
480  const auto ta_y_top = vld2q_u8(in_y.ptr());
481  const auto ta_y_bottom = vld2q_u8(in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y());
482  const auto ta_uv = vld2q_u8(in_uv.ptr());
483  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
484  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
485  //ta_uv.val[0] = U0 U2 U4 U6 ...
486  //ta_uv.val[1] = V0 V2 V4 V6 ...
487 
488  // Convert the uint8x16x4_t to float32x4x4_t
489  float32x4x4_t yvec_top = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_top.val[0]);
490  float32x4x4_t yyvec_top = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_top.val[1]);
491  float32x4x4_t yvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_bottom.val[0]);
492  float32x4x4_t yyvec_bottom = arm_compute::convert_uint8x16_to_float32x4x4(ta_y_bottom.val[1]);
493  float32x4x4_t uvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_uv.val[0 + shift]);
494  float32x4x4_t vvec = arm_compute::convert_uint8x16_to_float32x4x4(ta_uv.val[1 - shift]);
495 
496  yuyv_to_rgb_calculation(yvec_top.val[0], uvec.val[0], yyvec_top.val[0], vvec.val[0], out.ptr() + 0 * element_size, alpha);
497  yuyv_to_rgb_calculation(yvec_top.val[1], uvec.val[1], yyvec_top.val[1], vvec.val[1], out.ptr() + 1 * element_size, alpha);
498  yuyv_to_rgb_calculation(yvec_top.val[2], uvec.val[2], yyvec_top.val[2], vvec.val[2], out.ptr() + 2 * element_size, alpha);
499  yuyv_to_rgb_calculation(yvec_top.val[3], uvec.val[3], yyvec_top.val[3], vvec.val[3], out.ptr() + 3 * element_size, alpha);
500 
501  yuyv_to_rgb_calculation(yvec_bottom.val[0], uvec.val[0], yyvec_bottom.val[0], vvec.val[0], out.ptr() + out_stride + 0 * element_size, alpha);
502  yuyv_to_rgb_calculation(yvec_bottom.val[1], uvec.val[1], yyvec_bottom.val[1], vvec.val[1], out.ptr() + out_stride + 1 * element_size, alpha);
503  yuyv_to_rgb_calculation(yvec_bottom.val[2], uvec.val[2], yyvec_bottom.val[2], vvec.val[2], out.ptr() + out_stride + 2 * element_size, alpha);
504  yuyv_to_rgb_calculation(yvec_bottom.val[3], uvec.val[3], yyvec_bottom.val[3], vvec.val[3], out.ptr() + out_stride + 3 * element_size, alpha);
505  },
506  in_y, in_uv, out);
507 }
float32x4x4_t convert_uint8x16_to_float32x4x4(const uint8x16_t &in)
Converts from uint8x16 to float32x4x4_t.
Definition: NEMath.inl:362
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void yuyv_to_rgb_calculation(const SimpleTensor< T > yvec, const SimpleTensor< T > vvec, const SimpleTensor< T > yyvec, const SimpleTensor< T > uvec, SimpleTensor< T > &dst)
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor&#39;s metadata.
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77
T y() const
Alias to access the size of the second dimension.
Definition: Dimensions.h:92
virtual const Strides & strides_in_bytes() const =0
The strides in bytes for accessing each dimension of the tensor.

◆ colorconvert_nv12_to_yuv4()

void arm_compute::colorconvert_nv12_to_yuv4 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert NV12 to YUV4.

Parameters
[in]inputInput NV12 data buffer.
[out]outputOutput YUV4 buffer.
[in]winWindow for iterating the buffers.

Definition at line 815 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

816 {
817  ARM_COMPUTE_ERROR_ON(nullptr == input);
818  ARM_COMPUTE_ERROR_ON(nullptr == output);
819  win.validate();
820 
821  const auto input_ptr = static_cast<const IMultiImage *__restrict>(input);
822  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
823 
824  constexpr auto shift = uv ? 0 : 1;
825 
826  // UV's width and height are subsampled
827  Window win_uv(win);
828  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
829  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
830  win_uv.validate();
831 
832  Iterator in_y(input_ptr->plane(0), win);
833  Iterator in_uv(input_ptr->plane(1), win_uv);
834  Iterator out_y(output_ptr->plane(0), win);
835  Iterator out_u(output_ptr->plane(1), win);
836  Iterator out_v(output_ptr->plane(2), win);
837 
838  execute_window_loop(win, [&](const Coordinates &)
839  {
840  const auto ta_y_top = vld2q_u8(in_y.ptr());
841  const auto ta_y_bottom = vld2q_u8(in_y.ptr() + input_ptr->plane(0)->info()->strides_in_bytes().y());
842  const auto ta_uv = vld2q_u8(in_uv.ptr());
843  //ta_y.val[0] = Y0 Y2 Y4 Y6 ...
844  //ta_y.val[1] = Y1 Y3 Y5 Y7 ...
845  //ta_uv.val[0] = U0 U2 U4 U6 ...
846  //ta_uv.val[1] = V0 V2 V4 V6 ...
847 
848  vst2q_u8(out_y.ptr(), ta_y_top);
849  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), ta_y_bottom);
850 
851  uint8x16x2_t uvec;
852  uvec.val[0] = ta_uv.val[0 + shift];
853  uvec.val[1] = ta_uv.val[0 + shift];
854  vst2q_u8(out_u.ptr(), uvec);
855  vst2q_u8(out_u.ptr() + output_ptr->plane(1)->info()->strides_in_bytes().y(), uvec);
856 
857  uint8x16x2_t vvec;
858  vvec.val[0] = ta_uv.val[1 - shift];
859  vvec.val[1] = ta_uv.val[1 - shift];
860  vst2q_u8(out_v.ptr(), vvec);
861  vst2q_u8(out_v.ptr() + output_ptr->plane(2)->info()->strides_in_bytes().y(), vvec);
862  },
863  in_y, in_uv, out_y, out_u, out_v);
864 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgb_to_iyuv()

void arm_compute::colorconvert_rgb_to_iyuv ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert RGB to IYUV.

Parameters
[in]inputInput RGB data buffer.
[out]outputOutput IYUV buffer.
[in]winWindow for iterating the buffers.

Definition at line 975 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

976 {
977  ARM_COMPUTE_ERROR_ON(nullptr == input);
978  ARM_COMPUTE_ERROR_ON(nullptr == output);
979  win.validate();
980 
981  const auto input_ptr = static_cast<const IImage *__restrict>(input);
982  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
983 
984  // UV's width and height are subsampled
985  Window win_uv(win);
986  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
987  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
988  win_uv.validate();
989 
990  Iterator in(input_ptr, win);
991  Iterator out_y(output_ptr->plane(0), win);
992  Iterator out_u(output_ptr->plane(1), win_uv);
993  Iterator out_v(output_ptr->plane(2), win_uv);
994 
995  execute_window_loop(win, [&](const Coordinates &)
996  {
997  const auto ta_rgb_top = load_rgb(in.ptr(), alpha);
998  const auto ta_rgb_bottom = load_rgb(in.ptr() + input_ptr->info()->strides_in_bytes().y(), alpha);
999  //ta_rgb.val[0] = R0 R1 R2 R3 ...
1000  //ta_rgb.val[1] = G0 G1 G2 G3 ...
1001  //ta_rgb.val[2] = B0 B1 B2 B3 ...
1002 
1003  store_rgb_to_iyuv(ta_rgb_top.val[0], ta_rgb_top.val[1], ta_rgb_top.val[2],
1004  ta_rgb_bottom.val[0], ta_rgb_bottom.val[1], ta_rgb_bottom.val[2],
1005  out_y.ptr(), out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(),
1006  out_u.ptr(), out_v.ptr());
1007  },
1008  in, out_y, out_u, out_v);
1009 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgb_to_nv12()

void arm_compute::colorconvert_rgb_to_nv12 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert RGB to NV12.

Parameters
[in]inputInput RGB data buffer.
[out]outputOutput NV12 buffer.
[in]winWindow for iterating the buffers.

Definition at line 932 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

933 {
934  ARM_COMPUTE_ERROR_ON(nullptr == input);
935  ARM_COMPUTE_ERROR_ON(nullptr == output);
936  win.validate();
937 
938  const auto input_ptr = static_cast<const IImage *__restrict>(input);
939  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
940 
941  // UV's width and height are subsampled
942  Window win_uv(win);
943  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
944  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
945  win_uv.validate();
946 
947  Iterator in(input_ptr, win);
948  Iterator out_y(output_ptr->plane(0), win);
949  Iterator out_uv(output_ptr->plane(1), win_uv);
950 
951  execute_window_loop(win, [&](const Coordinates &)
952  {
953  const auto ta_rgb_top = load_rgb(in.ptr(), alpha);
954  const auto ta_rgb_bottom = load_rgb(in.ptr() + input_ptr->info()->strides_in_bytes().y(), alpha);
955  //ta_rgb.val[0] = R0 R1 R2 R3 ...
956  //ta_rgb.val[1] = G0 G1 G2 G3 ...
957  //ta_rgb.val[2] = B0 B1 B2 B3 ...
958 
959  store_rgb_to_nv12(ta_rgb_top.val[0], ta_rgb_top.val[1], ta_rgb_top.val[2],
960  ta_rgb_bottom.val[0], ta_rgb_bottom.val[1], ta_rgb_bottom.val[2],
961  out_y.ptr(), out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(),
962  out_uv.ptr());
963  },
964  in, out_y, out_uv);
965 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgb_to_rgbx()

void arm_compute::colorconvert_rgb_to_rgbx ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert RGB to RGBX.

Parameters
[in]inputInput RGB data buffer.
[out]outputOutput RGBX buffer.
[in]winWindow for iterating the buffers.

Definition at line 321 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, execute_window_loop(), arm_compute::test::validation::input, and Iterator::ptr().

322 {
323  ARM_COMPUTE_ERROR_ON(nullptr == input);
324  ARM_COMPUTE_ERROR_ON(nullptr == output);
325 
326  const auto input_ptr = static_cast<const IImage *__restrict>(input);
327  const auto output_ptr = static_cast<IImage *__restrict>(output);
328 
329  Iterator in(input_ptr, win);
330  Iterator out(output_ptr, win);
331 
332  execute_window_loop(win, [&](const Coordinates &)
333  {
334  const auto ta1 = vld3q_u8(in.ptr());
335  uint8x16x4_t ta2;
336  ta2.val[0] = ta1.val[0];
337  ta2.val[1] = ta1.val[1];
338  ta2.val[2] = ta1.val[2];
339  ta2.val[3] = vdupq_n_u8(255);
340  vst4q_u8(out.ptr(), ta2);
341  },
342  in, out);
343 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgb_to_u8()

void arm_compute::colorconvert_rgb_to_u8 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert RGB to U8.

Parameters
[in]inputInput RGB data buffer.
[out]outputOutput U8 buffer.
[in]winWindow for iterating the buffers.

Definition at line 352 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, execute_window_loop(), arm_compute::test::validation::input, and Iterator::ptr().

353 {
354  ARM_COMPUTE_ERROR_ON(nullptr == input);
355  ARM_COMPUTE_ERROR_ON(nullptr == output);
356 
357  const auto input_ptr = static_cast<const IImage *__restrict>(input);
358  const auto output_ptr = static_cast<IImage *__restrict>(output);
359 
360  Iterator in(input_ptr, win);
361  Iterator out(output_ptr, win);
362 
363  execute_window_loop(win, [&](const Coordinates &)
364  {
365  const auto ta1 = vld3q_u8(in.ptr());
366  uint8x16_t ta2;
367  rgb_to_u8_conversion(ta1, ta2);
368  vst1q_u8(out.ptr(), ta2);
369  },
370  in, out);
371 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgb_to_yuv4()

void arm_compute::colorconvert_rgb_to_yuv4 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert RGB to YUV4.

Parameters
[in]inputInput RGB data buffer.
[out]outputOutput YUV4 buffer.
[in]winWindow for iterating the buffers.

Definition at line 1019 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), and Window::validate().

1020 {
1021  ARM_COMPUTE_ERROR_ON(nullptr == input);
1022  ARM_COMPUTE_ERROR_ON(nullptr == output);
1023  win.validate();
1024 
1025  const auto input_ptr = static_cast<const IImage *__restrict>(input);
1026  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
1027 
1028  Iterator in(input_ptr, win);
1029  Iterator out_y(output_ptr->plane(0), win);
1030  Iterator out_u(output_ptr->plane(1), win);
1031  Iterator out_v(output_ptr->plane(2), win);
1032 
1033  execute_window_loop(win, [&](const Coordinates &)
1034  {
1035  const auto ta_rgb = load_rgb(in.ptr(), alpha);
1036  //ta_rgb.val[0] = R0 R1 R2 R3 ...
1037  //ta_rgb.val[1] = G0 G1 G2 G3 ...
1038  //ta_rgb.val[2] = B0 B1 B2 B3 ...
1039 
1040  store_rgb_to_yuv4(ta_rgb.val[0], ta_rgb.val[1], ta_rgb.val[2],
1041  out_y.ptr(), out_u.ptr(), out_v.ptr());
1042  },
1043  in, out_y, out_u, out_v);
1044 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_rgbx_to_rgb()

void arm_compute::colorconvert_rgbx_to_rgb ( const void *  input,
void *  output,
const Window win 
)

Convert RGBX to RGB.

Parameters
[in]inputInput RGBX data buffer.
[out]outputOutput RGB buffer.
[in]winWindow for iterating the buffers.

Definition at line 380 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, execute_window_loop(), arm_compute::test::validation::input, and Iterator::ptr().

381 {
382  ARM_COMPUTE_ERROR_ON(nullptr == input);
383  ARM_COMPUTE_ERROR_ON(nullptr == output);
384 
385  const auto input_ptr = static_cast<const IImage *__restrict>(input);
386  const auto output_ptr = static_cast<IImage *__restrict>(output);
387 
388  Iterator in(input_ptr, win);
389  Iterator out(output_ptr, win);
390 
391  execute_window_loop(win, [&](const Coordinates &)
392  {
393  const auto ta1 = vld4q_u8(in.ptr());
394  uint8x16x3_t ta2;
395  ta2.val[0] = ta1.val[0];
396  ta2.val[1] = ta1.val[1];
397  ta2.val[2] = ta1.val[2];
398  vst3q_u8(out.ptr(), ta2);
399  },
400  in, out);
401 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_yuyv_to_iyuv()

void arm_compute::colorconvert_yuyv_to_iyuv ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert YUYV to IYUV.

Parameters
[in]inputInput YUYV data buffer.
[out]outputOutput IYUV buffer.
[in]winWindow for iterating the buffers.

Definition at line 755 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

756 {
757  ARM_COMPUTE_ERROR_ON(nullptr == input);
758  ARM_COMPUTE_ERROR_ON(nullptr == output);
759  win.validate();
760 
761  const auto input_ptr = static_cast<const IImage *__restrict>(input);
762  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
763 
764  constexpr auto shift = yuyv ? 0 : 1;
765 
766  // Destination's UV's width and height are subsampled
767  Window win_uv(win);
768  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
769  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
770  win_uv.validate();
771 
772  Iterator in(input_ptr, win);
773  Iterator out_y(output_ptr->plane(0), win);
774  Iterator out_u(output_ptr->plane(1), win_uv);
775  Iterator out_v(output_ptr->plane(2), win_uv);
776 
777  execute_window_loop(win, [&](const Coordinates &)
778  {
779  const auto ta_top = vld4q_u8(in.ptr());
780  const auto ta_bottom = vld4q_u8(in.ptr() + input_ptr->info()->strides_in_bytes().y());
781  //ta.val[0] = Y0 Y2 Y4 Y6 ...
782  //ta.val[1] = U0 U2 U4 U6 ...
783  //ta.val[2] = Y1 Y3 Y5 Y7 ...
784  //ta.val[3] = V0 V2 V4 V7 ...
785 
786  uint8x16x2_t yvec;
787  yvec.val[0] = ta_top.val[0 + shift];
788  yvec.val[1] = ta_top.val[2 + shift];
789  vst2q_u8(out_y.ptr(), yvec);
790 
791  uint8x16x2_t yyvec;
792  yyvec.val[0] = ta_bottom.val[0 + shift];
793  yyvec.val[1] = ta_bottom.val[2 + shift];
794  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), yyvec);
795 
796  uint8x16_t uvec;
797  uvec = vhaddq_u8(ta_top.val[1 - shift], ta_bottom.val[1 - shift]);
798  vst1q_u8(out_u.ptr(), uvec);
799 
800  uint8x16_t vvec;
801  vvec = vhaddq_u8(ta_top.val[3 - shift], ta_bottom.val[3 - shift]);
802  vst1q_u8(out_v.ptr(), vvec);
803  },
804  in, out_y, out_u, out_v);
805 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_yuyv_to_nv12()

void arm_compute::colorconvert_yuyv_to_nv12 ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert YUYV to NV12.

Parameters
[in]inputInput YUYV data buffer.
[out]outputOutput NV12 buffer.
[in]winWindow for iterating the buffers.

Definition at line 603 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, Window::DimX, Window::DimY, Window::Dimension::end(), execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), Window::set(), Window::Dimension::start(), Window::Dimension::step(), Window::validate(), Window::x(), and Window::y().

604 {
605  ARM_COMPUTE_ERROR_ON(nullptr == input);
606  ARM_COMPUTE_ERROR_ON(nullptr == output);
607  win.validate();
608 
609  const auto input_ptr = static_cast<const IImage *__restrict>(input);
610  const auto output_ptr = static_cast<IMultiImage *__restrict>(output);
611 
612  constexpr auto shift = yuyv ? 0 : 1;
613 
614  // NV12's UV's width and height are subsampled
615  Window win_uv(win);
616  win_uv.set(Window::DimX, Window::Dimension(win_uv.x().start() / 2, win_uv.x().end() / 2, win_uv.x().step() / 2));
617  win_uv.set(Window::DimY, Window::Dimension(win_uv.y().start() / 2, win_uv.y().end() / 2, 1));
618  win_uv.validate();
619 
620  Iterator in(input_ptr, win);
621  Iterator out_y(output_ptr->plane(0), win);
622  Iterator out_uv(output_ptr->plane(1), win_uv);
623 
624  execute_window_loop(win, [&](const Coordinates &)
625  {
626  const auto ta_top = vld4q_u8(in.ptr());
627  const auto ta_bottom = vld4q_u8(in.ptr() + input_ptr->info()->strides_in_bytes().y());
628  //ta.val[0] = Y0 Y2 Y4 Y6 ...
629  //ta.val[1] = U0 U2 U4 U6 ...
630  //ta.val[2] = Y1 Y3 Y5 Y7 ...
631  //ta.val[3] = V0 V2 V4 V7 ...
632 
633  uint8x16x2_t yvec;
634  yvec.val[0] = ta_top.val[0 + shift];
635  yvec.val[1] = ta_top.val[2 + shift];
636  vst2q_u8(out_y.ptr(), yvec);
637 
638  uint8x16x2_t yyvec;
639  yyvec.val[0] = ta_bottom.val[0 + shift];
640  yyvec.val[1] = ta_bottom.val[2 + shift];
641  vst2q_u8(out_y.ptr() + output_ptr->plane(0)->info()->strides_in_bytes().y(), yyvec);
642 
643  uint8x16x2_t uvvec;
644  uvvec.val[0] = vhaddq_u8(ta_top.val[1 - shift], ta_bottom.val[1 - shift]);
645  uvvec.val[1] = vhaddq_u8(ta_top.val[3 - shift], ta_bottom.val[3 - shift]);
646  vst2q_u8(out_uv.ptr(), uvvec);
647  },
648  in, out_y, out_uv);
649 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ colorconvert_yuyv_to_rgb()

void arm_compute::colorconvert_yuyv_to_rgb ( const void *__restrict  input,
void *__restrict  output,
const Window win 
)

Convert YUYV to RGB.

Parameters
[in]inputInput YUYV data buffer.
[out]outputOutput RGB buffer.
[in]winWindow for iterating the buffers.

Definition at line 411 of file NEColorConvertHelper.inl.

References ARM_COMPUTE_ERROR_ON, convert_uint8x16_to_float32x4x4(), execute_window_loop(), arm_compute::test::validation::input, Iterator::ptr(), and arm_compute::test::colorconvert_helper::detail::yuyv_to_rgb_calculation().

412 {
413  ARM_COMPUTE_ERROR_ON(nullptr == input);
414  ARM_COMPUTE_ERROR_ON(nullptr == output);
415 
416  const auto input_ptr = static_cast<const IImage *__restrict>(input);
417  const auto output_ptr = static_cast<IImage *__restrict>(output);
418 
419  constexpr auto element_size = alpha ? 32 : 24;
420  constexpr auto shift = yuyv ? 0 : 1;
421 
422  Iterator in(input_ptr, win);
423  Iterator out(output_ptr, win);
424 
425  execute_window_loop(win, [&](const Coordinates &)
426  {
427  const auto ta = vld4q_u8(in.ptr());
428  //ta.val[0] = Y0 Y2 Y4 Y6 ...
429  //ta.val[1] = U0 U2 U4 U6 ...
430  //ta.val[2] = Y1 Y3 Y5 Y7 ...
431  //ta.val[3] = V0 V2 V4 V7 ...
432 
433  // Convert the uint8x16x4_t to float32x4x4_t
434  const float32x4x4_t yvec = arm_compute::convert_uint8x16_to_float32x4x4(ta.val[0 + shift]);
435  const float32x4x4_t uvec = arm_compute::convert_uint8x16_to_float32x4x4(ta.val[1 - shift]);
436  const float32x4x4_t yyvec = arm_compute::convert_uint8x16_to_float32x4x4(ta.val[2 + shift]);
437  const float32x4x4_t vvec = arm_compute::convert_uint8x16_to_float32x4x4(ta.val[3 - shift]);
438 
439  yuyv_to_rgb_calculation(yvec.val[0], uvec.val[0], yyvec.val[0], vvec.val[0], out.ptr() + 0 * element_size, alpha);
440  yuyv_to_rgb_calculation(yvec.val[1], uvec.val[1], yyvec.val[1], vvec.val[1], out.ptr() + 1 * element_size, alpha);
441  yuyv_to_rgb_calculation(yvec.val[2], uvec.val[2], yyvec.val[2], vvec.val[2], out.ptr() + 2 * element_size, alpha);
442  yuyv_to_rgb_calculation(yvec.val[3], uvec.val[3], yyvec.val[3], vvec.val[3], out.ptr() + 3 * element_size, alpha);
443  },
444  in, out);
445 }
float32x4x4_t convert_uint8x16_to_float32x4x4(const uint8x16_t &in)
Converts from uint8x16 to float32x4x4_t.
Definition: NEMath.inl:362
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void yuyv_to_rgb_calculation(const SimpleTensor< T > yvec, const SimpleTensor< T > vvec, const SimpleTensor< T > yyvec, const SimpleTensor< T > uvec, SimpleTensor< T > &dst)
ITensor IImage
Definition: ITensor.h:100
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ compute_requantization_scale_offset()

UniformQuantizationInfo arm_compute::compute_requantization_scale_offset ( const UniformQuantizationInfo uqinfo_in,
const UniformQuantizationInfo uqinfo_out 
)
inline

Definition at line 622 of file QuantizationInfo.h.

References UniformQuantizationInfo::offset, UniformQuantizationInfo::scale, and UniformQuantizationInfo::UniformQuantizationInfo().

Referenced by CLROIPoolingLayerKernel::configure(), and CpuQuantizeKernel::validate().

623 {
624  float scale_to_apply = uqinfo_out.scale;
625  int32_t offset_to_apply = uqinfo_out.offset;
626 
627  scale_to_apply /= uqinfo_in.scale;
628  // In order to minimize flooring we convert the offset to a float,
629  // then compute the new offset in the float domain,
630  // finally we convert it back as int32_t
631  offset_to_apply -= static_cast<int32_t>(static_cast<float>(uqinfo_in.offset) * uqinfo_in.scale / uqinfo_out.scale);
632  return UniformQuantizationInfo(scale_to_apply, offset_to_apply);
633 }

◆ compute_strides() [1/2]

Strides arm_compute::compute_strides ( const ITensorInfo info,
stride_x,
Ts &&...  fixed_strides 
)
inline

Create a strides object based on the provided strides and the tensor dimensions.

Parameters
[in]infoTensor info object providing the shape of the tensor for unspecified strides.
[in]stride_xStride to be used in X dimension (in bytes).
[in]fixed_stridesStrides to be used in higher dimensions starting at Y (in bytes).
Returns
Strides object based on the specified strides. Missing strides are calculated based on the tensor shape and the strides of lower dimensions.

Definition at line 41 of file Utils.h.

References ITensorInfo::num_dimensions(), Dimensions< T >::set(), arm_compute::test::validation::shape, and ITensorInfo::tensor_shape().

Referenced by TensorInfo::auto_padding(), compute_strides(), and TensorInfo::set_tensor_shape().

42 {
43  const TensorShape &shape = info.tensor_shape();
44 
45  // Create strides object
46  Strides strides(stride_x, fixed_strides...);
47 
48  for(size_t i = 1 + sizeof...(Ts); i < info.num_dimensions(); ++i)
49  {
50  strides.set(i, shape[i - 1] * strides[i - 1]);
51  }
52 
53  return strides;
54 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ compute_strides() [2/2]

Strides arm_compute::compute_strides ( const ITensorInfo info)
inline

Create a strides object based on the tensor dimensions.

Parameters
[in]infoTensor info object used to compute the strides.
Returns
Strides object based on element size and tensor shape.

Definition at line 63 of file Utils.h.

References compute_strides(), and ITensorInfo::element_size().

64 {
65  return compute_strides(info, info.element_size());
66 }
Strides compute_strides(const ITensorInfo &info)
Create a strides object based on the tensor dimensions.
Definition: Utils.h:63
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ compute_winograd_convolution_tiles()

Size2D arm_compute::compute_winograd_convolution_tiles ( const Size2D in_dims,
const Size2D kernel_size,
const Size2D output_tile_size,
const PadStrideInfo conv_info 
)
inline

Calculate the number of output tiles required by Winograd Convolution layer.

This utility function can be used by the Winograd input transform to know the number of tiles on the x and y direction

Parameters
[in]in_dimsSpatial dimensions of the input tensor of convolution layer
[in]kernel_sizeKernel size
[in]output_tile_sizeSize of a single output tile
[in]conv_infoConvolution info (i.e. pad, stride,...)
Returns
the number of output tiles along the x and y directions of size "output_tile_size"

Definition at line 227 of file Helpers.h.

References Size2D::height, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), and Size2D::width.

Referenced by arm_compute::misc::shape_calculator::compute_winograd_input_transform_shape(), ClWinogradInputTransformKernel::configure(), ClWinogradOutputTransformKernel::configure(), arm_compute::test::validation::reference::winograd_input_transform(), and arm_compute::test::validation::reference::winograd_output_transform().

228 {
229  int num_tiles_x = std::ceil((in_dims.width - (kernel_size.width - 1) + conv_info.pad_left() + conv_info.pad_right()) / static_cast<float>(output_tile_size.width));
230  int num_tiles_y = std::ceil((in_dims.height - (kernel_size.height - 1) + conv_info.pad_top() + conv_info.pad_bottom()) / static_cast<float>(output_tile_size.height));
231 
232  // Clamp in case we provide paddings but we have 1D convolution
233  num_tiles_x = std::min(num_tiles_x, static_cast<int>(in_dims.width));
234  num_tiles_y = std::min(num_tiles_y, static_cast<int>(in_dims.height));
235 
236  return Size2D(num_tiles_x, num_tiles_y);
237 }

◆ convert_float32x4x3_to_uint8x8x3()

void convert_float32x4x3_to_uint8x8x3 ( const float32x4x3_t &  in1,
const float32x4x3_t &  in2,
uint8x8x3_t &  out 
)
inline

Converts from two float32x4x3_t to just one uint8x8x3_t.

Parameters
[in]in1First input vector of float to be converted
[in]in2Second input vector of float to be converted
[out]outConverted output vector uint8 to store the result

Definition at line 402 of file NEMath.inl.

403 {
404  out.val[0] = vqmovn_u16(vcombine_u16(vqmovn_u32(vcvtq_u32_f32(in1.val[0])),
405  vqmovn_u32(vcvtq_u32_f32(in2.val[0]))));
406  out.val[1] = vqmovn_u16(vcombine_u16(vqmovn_u32(vcvtq_u32_f32(in1.val[1])),
407  vqmovn_u32(vcvtq_u32_f32(in2.val[1]))));
408  out.val[2] = vqmovn_u16(vcombine_u16(vqmovn_u32(vcvtq_u32_f32(in1.val[2])),
409  vqmovn_u32(vcvtq_u32_f32(in2.val[2]))));
410 }

◆ convert_float32x4x4_to_int8x16()

void convert_float32x4x4_to_int8x16 ( const float32x4x4_t &  in,
int8x16_t &  out 
)
inline

Converts from float32x4x4_t to just one int8x16_t.

Parameters
[in]inVector of float to be converted
[out]outConverted vector of uint8 to store the result

Definition at line 421 of file NEMath.inl.

Referenced by convert_float_to_int< float32x4x4_t, int8x16_t >().

422 {
423  const auto low = vcombine_s16(vqmovn_s32(vcvtq_s32_f32(in.val[0])),
424  vqmovn_s32(vcvtq_s32_f32(in.val[1])));
425  const auto high = vcombine_s16(vqmovn_s32(vcvtq_s32_f32(in.val[2])),
426  vqmovn_s32(vcvtq_s32_f32(in.val[3])));
427  out = vcombine_s8(vqmovn_s16(low), vqmovn_s16(high));
428 }

◆ convert_float32x4x4_to_uint8x16()

void convert_float32x4x4_to_uint8x16 ( const float32x4x4_t &  in,
uint8x16_t &  out 
)
inline

Converts from two float32x4x4_t to just one uint8x16_t.

Parameters
[in]inVector of float to be converted
[out]outConverted vector of uint8 to store the result

Definition at line 412 of file NEMath.inl.

Referenced by convert_float_to_int< float32x4x4_t, uint8x16_t >().

413 {
414  const auto low = vcombine_u16(vqmovn_u32(vcvtq_u32_f32(in.val[0])),
415  vqmovn_u32(vcvtq_u32_f32(in.val[1])));
416  const auto high = vcombine_u16(vqmovn_u32(vcvtq_u32_f32(in.val[2])),
417  vqmovn_u32(vcvtq_u32_f32(in.val[3])));
418  out = vcombine_u8(vqmovn_u16(low), vqmovn_u16(high));
419 }

◆ convert_float_to_int()

int_vec_type arm_compute::convert_float_to_int ( const float_vec_type &  in)

Converts from float vector to integer vector.

Parameters
[in]inFloat vector to converted
Returns
The converted integer vector

◆ convert_float_to_int< float32x4x4_t, int8x16_t >()

int8x16_t arm_compute::convert_float_to_int< float32x4x4_t, int8x16_t > ( const float32x4x4_t &  in)
inline

Definition at line 445 of file NEMath.inl.

References convert_float32x4x4_to_int8x16().

446 {
447  int8x16_t out;
449  return out;
450 }
void convert_float32x4x4_to_int8x16(const float32x4x4_t &in, int8x16_t &out)
Converts from float32x4x4_t to just one int8x16_t.
Definition: NEMath.inl:421

◆ convert_float_to_int< float32x4x4_t, uint8x16_t >()

uint8x16_t arm_compute::convert_float_to_int< float32x4x4_t, uint8x16_t > ( const float32x4x4_t &  in)
inline

Definition at line 431 of file NEMath.inl.

References convert_float32x4x4_to_uint8x16().

432 {
433  uint8x16_t out;
435  return out;
436 }
void convert_float32x4x4_to_uint8x16(const float32x4x4_t &in, uint8x16_t &out)
Converts from two float32x4x4_t to just one uint8x16_t.
Definition: NEMath.inl:412

◆ convert_int8x16_to_float32x4x4()

float32x4x4_t convert_int8x16_to_float32x4x4 ( const int8x16_t &  in)
inline

Converts from int8x16 to float32x4x4_t.

Parameters
[in]inVector of int8 to be converted
Returns
Converted vector of float

Definition at line 376 of file NEMath.inl.

Referenced by convert_int_to_float< float32x4x4_t, int8x16_t >(), and convert_to_float32x4x4().

377 {
378  float32x4x4_t out;
379 
380  const auto tmp1 = vmovl_s8(vget_low_s8(in));
381  out.val[0] = vcvtq_f32_s32(vmovl_s16(vget_low_s16(tmp1)));
382  out.val[1] = vcvtq_f32_s32(vmovl_s16(vget_high_s16(tmp1)));
383 
384  const auto tmp2 = vmovl_s8(vget_high_s8(in));
385  out.val[2] = vcvtq_f32_s32(vmovl_s16(vget_low_s16(tmp2)));
386  out.val[3] = vcvtq_f32_s32(vmovl_s16(vget_high_s16(tmp2)));
387  return out;
388 }

◆ convert_int_to_float()

float_vec_type arm_compute::convert_int_to_float ( const int_vec_type &  in)

Converts from integer vector to float vector.

Parameters
[in]inInteger vector to converted
Returns
The converted float vector

◆ convert_int_to_float< float32x4x4_t, int8x16_t >()

float32x4x4_t arm_compute::convert_int_to_float< float32x4x4_t, int8x16_t > ( const int8x16_t &  in)
inline

Definition at line 453 of file NEMath.inl.

References convert_int8x16_to_float32x4x4().

454 {
456 }
float32x4x4_t convert_int8x16_to_float32x4x4(const int8x16_t &in)
Converts from int8x16 to float32x4x4_t.
Definition: NEMath.inl:376

◆ convert_int_to_float< float32x4x4_t, uint8x16_t >()

float32x4x4_t arm_compute::convert_int_to_float< float32x4x4_t, uint8x16_t > ( const uint8x16_t &  in)
inline

Definition at line 439 of file NEMath.inl.

References convert_uint8x16_to_float32x4x4().

440 {
442 }
float32x4x4_t convert_uint8x16_to_float32x4x4(const uint8x16_t &in)
Converts from uint8x16 to float32x4x4_t.
Definition: NEMath.inl:362

◆ convert_negative_axis()

Coordinates& arm_compute::convert_negative_axis ( Coordinates coords,
int  max_value 
)
inline

Convert negative coordinates to positive in the range [0, num_dims_input].

Parameters
[out]coordsArray of coordinates to be converted.
[in]max_valueMaximum value to be used when wrapping the negative values in coords

Definition at line 257 of file Helpers.h.

References Dimensions< T >::num_dimensions(), and wrap_around().

Referenced by arm_compute::misc::shape_calculator::calculate_reduce_mean_shape(), NEReduceMean::configure(), and CLReduceMean::configure().

258 {
259  for(unsigned int i = 0; i < coords.num_dimensions(); ++i)
260  {
261  coords[i] = wrap_around(coords[i], max_value);
262  }
263  return coords;
264 }
T wrap_around(T x, T m)
Wrap-around a number within the range 0 <= x < m.
Definition: Helpers.h:247

◆ convert_to_float32x4x4() [1/3]

float32x4x4_t arm_compute::convert_to_float32x4x4 ( const T &  in)

Converts to float32x4x4_t from the specified templated 16 elements vectors.

Parameters
[in]inVector of float to be converted
Returns
Converted vector of float

◆ convert_to_float32x4x4() [2/3]

float32x4x4_t arm_compute::convert_to_float32x4x4 ( const uint8x16_t &  in)
inline

Definition at line 391 of file NEMath.inl.

References convert_uint8x16_to_float32x4x4().

392 {
394 }
float32x4x4_t convert_uint8x16_to_float32x4x4(const uint8x16_t &in)
Converts from uint8x16 to float32x4x4_t.
Definition: NEMath.inl:362

◆ convert_to_float32x4x4() [3/3]

float32x4x4_t arm_compute::convert_to_float32x4x4 ( const int8x16_t &  in)
inline

Definition at line 397 of file NEMath.inl.

References convert_int8x16_to_float32x4x4().

398 {
400 }
float32x4x4_t convert_int8x16_to_float32x4x4(const int8x16_t &in)
Converts from int8x16 to float32x4x4_t.
Definition: NEMath.inl:376

◆ convert_uint8x16_to_float32x4x4()

float32x4x4_t convert_uint8x16_to_float32x4x4 ( const uint8x16_t &  in)
inline

Converts from uint8x16 to float32x4x4_t.

Parameters
[in]inVector of uint8 to be converted
Returns
Converted vector of float

Definition at line 362 of file NEMath.inl.

Referenced by colorconvert_iyuv_to_rgb(), colorconvert_nv12_to_rgb(), colorconvert_yuyv_to_rgb(), convert_int_to_float< float32x4x4_t, uint8x16_t >(), and convert_to_float32x4x4().

363 {
364  float32x4x4_t out;
365 
366  const auto tmp1 = vmovl_u8(vget_low_u8(in));
367  out.val[0] = vcvtq_f32_u32(vmovl_u16(vget_low_u16(tmp1)));
368  out.val[1] = vcvtq_f32_u32(vmovl_u16(vget_high_u16(tmp1)));
369 
370  const auto tmp2 = vmovl_u8(vget_high_u8(in));
371  out.val[2] = vcvtq_f32_u32(vmovl_u16(vget_low_u16(tmp2)));
372  out.val[3] = vcvtq_f32_u32(vmovl_u16(vget_high_u16(tmp2)));
373  return out;
374 }

◆ convert_window_coord_to_position()

Coordinates arm_compute::convert_window_coord_to_position ( const Window w,
const Coordinates offset 
)
inline

Convert an offset in window steps into absolute coordinates.

Parameters
[in]wWindow offset is related to.
[in]offsetOffset inside the window expressed in number of window steps.
Returns
Absolute coordinates.

Definition at line 41 of file WindowIterator.h.

References Dimensions< int >::num_max_dimensions, Dimensions< T >::set(), and arm_compute::cpu::step.

42 {
43  Coordinates position;
44  for(unsigned int i = 0; i < Coordinates::num_max_dimensions; ++i)
45  {
46  position.set(i, w[i].start() + offset[i] * w[i].step());
47  }
48  return position;
49 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084
SimpleTensor< float > w
Definition: DFT.cpp:156
constexpr int step
Definition: fp32.cpp:35

◆ coords2index()

int coords2index ( const TensorShape shape,
const Coordinates coord 
)
inline

Convert n-dimensional coordinates into a linear index.

Parameters
[in]shapeShape of the n-dimensional tensor.
[in]coordN-dimensional coordinates.
Returns
linead index

Definition at line 175 of file Helpers.inl.

References ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, Dimensions< T >::num_dimensions(), and TensorShape::total_size().

Referenced by arm_compute::test::validation::reference::convert_fully_connected_weights(), permute(), and arm_compute::test::validation::reference::winograd_input_transform().

176 {
177  int num_elements = shape.total_size();
178  ARM_COMPUTE_UNUSED(num_elements);
179  ARM_COMPUTE_ERROR_ON_MSG(num_elements == 0, "Cannot create linear index from empty shape!");
180 
181  int index = 0;
182  int stride = 1;
183 
184  for(unsigned int d = 0; d < coord.num_dimensions(); ++d)
185  {
186  index += coord[d] * stride;
187  stride *= shape[d];
188  }
189 
190  return index;
191 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ cpu_impl_dt()

std::string arm_compute::cpu_impl_dt ( const DataType data_type)
inline

Returns the suffix string of CPU kernel implementation names based on the given data type.

Parameters
[in]data_typeThe data type the CPU kernel implemetation uses
Returns
the suffix string of CPU kernel implementations

Definition at line 1245 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, arm_compute::test::validation::n, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8_PER_CHANNEL, S16, S32, arm_compute::test::validation::ss(), type, and U8.

Referenced by arm_compute::test::validation::DATA_TEST_CASE().

1246 {
1247  std::string ret = "";
1248 
1249  switch(data_type)
1250  {
1251  case DataType::F32:
1252  ret = "fp32";
1253  break;
1254  case DataType::F16:
1255  ret = "fp16";
1256  break;
1257  case DataType::U8:
1258  ret = "u8";
1259  break;
1260  case DataType::S16:
1261  ret = "s16";
1262  break;
1263  case DataType::S32:
1264  ret = "s32";
1265  break;
1266  case DataType::QASYMM8:
1267  ret = "qu8";
1268  break;
1269  case DataType::QASYMM8_SIGNED:
1270  ret = "qs8";
1271  break;
1272  case DataType::QSYMM16:
1273  ret = "qs16";
1274  break;
1275  case DataType::QSYMM8_PER_CHANNEL:
1276  ret = "qp8";
1277  break;
1278  case DataType::BFLOAT16:
1279  ret = "bf16";
1280  break;
1281  default:
1282  ARM_COMPUTE_ERROR("Unsupported.");
1283  }
1284 
1285  return ret;
1286 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ create_error()

Status create_error ( ErrorCode  error_code,
std::string  msg 
)

Creates an error containing the error message.

Parameters
[in]error_codeError code
[in]msgMessage to display before abandoning.
Returns
status containing the error

Definition at line 34 of file Error.cpp.

Referenced by Status::throw_if_error().

35 {
36  return Status(error_code, msg);
37 }
Status class.
Definition: Error.h:52

◆ create_error_msg()

Status create_error_msg ( ErrorCode  error_code,
const char *  func,
const char *  file,
int  line,
const char *  msg 
)

Creates an error and the error message.

Parameters
[in]error_codeError code
[in]funcFunction in which the error occurred.
[in]fileFile in which the error occurred.
[in]lineLine in which the error occurred.
[in]msgMessage to display before abandoning.
Returns
status containing the error

Definition at line 39 of file Error.cpp.

References arm_compute::support::cpp11::snprintf().

Referenced by Status::throw_if_error().

40 {
41  std::array<char, 512> out{ 0 };
42  snprintf(out.data(), out.size(), "in %s %s:%d: %s", func, file, line, msg);
43  return Status(error_code, std::string(out.data()));
44 }
Status class.
Definition: Error.h:52
int snprintf(char *s, std::size_t n, const char *fmt, Ts &&... args)
Loads the data from the given location, converts them to character string equivalents and writes the ...

◆ create_image2d_from_buffer()

cl::Image2D create_image2d_from_buffer ( const cl::Context &  ctx,
const cl::Buffer &  buffer,
const TensorShape shape2d,
DataType  data_type,
size_t  image_row_pitch 
)

Create a cl::Image2D object from an OpenCL buffer.

Note
The following conditions are required to create a OpenCL image object from OpenCL buffer,
  1. The platform should support the OpenCL cl_khr_image2d_from_buffer extension
  2. The stride Y for the input1 should satisfy the OpenCL pitch alignment requirement
  3. input width should be less or equal to (CL_DEVICE_IMAGE2D_MAX_WIDTH * 4)
  4. input height should be less or equal to CL_DEVICE_IMAGE2D_MAX_HEIGHT

It is user responsibility to ensure the above conditions are satisfied since no checks are performed within this function

Parameters
[in]ctxcl::Context object
[in]buffercl::Buffer object from which the OpenCL image2d object is created
[in]shape2d2D tensor shape
[in]data_typeDataType to use. Only supported: F32,F16
[in]image_row_pitchImage row pitch (a.k.a. stride Y) to be used in the image2d object
Returns
cl::Image2D object

Definition at line 35 of file CLUtils.cpp.

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_MSG, ARM_COMPUTE_UNUSED, clCreateImage(), F16, and F32.

Referenced by ClCompositeKernel::configure(), ClKernelRuntime::configure(), CLDepthwiseConvolutionLayerNativeKernel::run(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::run_op(), ClDirectConv2dKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), and ClGemmMatrixMultiplyReshapedKernel::run_op().

36 {
37  cl_channel_type cl_data_type;
38 
39  switch(data_type)
40  {
41  case DataType::F32:
42  cl_data_type = CL_FLOAT;
43  break;
44  case DataType::F16:
45  cl_data_type = CL_HALF_FLOAT;
46  break;
47  default:
48  ARM_COMPUTE_ERROR("Data type not support with OpenCL image2d");
49  }
50 
51  cl_mem cl_image;
52  cl_int err = CL_SUCCESS;
53 
54  const cl_image_format format = { CL_RGBA, cl_data_type };
55 
56  cl_image_desc desc;
57  memset(&desc, 0, sizeof(desc));
58  desc.image_type = CL_MEM_OBJECT_IMAGE2D;
59  desc.mem_object = buffer();
60  desc.image_row_pitch = image_row_pitch;
61  desc.image_width = shape2d[0];
62  desc.image_height = shape2d[1];
63 
64  cl_image = clCreateImage(ctx(), CL_MEM_READ_ONLY, &format, &desc, nullptr, &err);
65 
66  ARM_COMPUTE_UNUSED(err);
67  ARM_COMPUTE_ERROR_ON_MSG(err != CL_SUCCESS, "Error during the creation of CL image from buffer");
68 
69  return cl::Image2D(cl_image);
70 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
cl_mem clCreateImage(cl_context context, cl_mem_flags flags, const cl_image_format *image_format, const cl_image_desc *image_desc, void *host_ptr, cl_int *errcode_ret)
Definition: OpenCL.cpp:1031
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ create_kernel()

cl::Kernel create_kernel ( const CLCompileContext ctx,
const std::string &  kernel_name,
const std::set< std::string > &  build_opts = std::set<std::string>() 
)

Creates an opencl kernel using a compile context.

Parameters
[in]ctxA compile context to be used to create the opencl kernel.
[in]kernel_nameThe kernel name.
[in]build_optsThe build options to be used for the opencl kernel compilation.
Returns
An opencl kernel

Definition at line 404 of file CLHelpers.cpp.

References CLCompileContext::create_kernel(), ClKernelLibrary::get(), ClKernelLibrary::kernel_path(), ClKernelLibrary::program(), and ClKernelLibrary::program_name().

Referenced by ClElementwiseKernel::ClElementwiseKernel(), ClReshapeKernel::configure(), ClTransposeKernel::configure(), ClDequantizeKernel::configure(), ClFloorKernel::configure(), ClCopyKernel::configure(), ClElementWiseUnaryKernel::configure(), ClFillKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClActivationKernel::configure(), ClWidthConcatenateKernel::configure(), ClQuantizeKernel::configure(), ClPermuteKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), CLStridedSliceKernel::configure(), ClBatchConcatenateKernel::configure(), ClCropKernel::configure(), ClDepthConcatenateKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CLBitwiseKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), CLSelectKernel::configure(), CLReverseKernel::configure(), CLChannelShuffleLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), CLDepthToSpaceLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLDeconvolutionLayerUpsampleKernel::configure(), CLComputeAllAnchorsKernel::configure(), ClCastKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), CLGatherKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLNormalizationLayerKernel::configure(), CLFFTScaleKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLComparisonKernel::configure(), CLTileKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), CLFFTDigitReverseKernel::configure(), CLReorgLayerKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), ClGemmReshapeRhsMatrixKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClGemmLowpOffsetContributionKernel::configure(), CLRangeKernel::configure(), ClDirectConv2dKernel::configure(), CLReductionOperationKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLPadLayerKernel::configure(), ClCol2ImKernel::configure(), CLFFTRadixStageKernel::configure(), CLPriorBoxLayerKernel::configure(), ClDirectConv3dKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLROIPoolingLayerKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), CLStackLayerKernel::configure(), CLFillBorderKernel::configure(), ClWeightsReshapeKernel::configure(), CLArgMinMaxLayerKernel::configure(), ClIm2ColKernel::configure(), CLROIAlignLayerKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), CLFuseBatchNormalizationKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClLogits1DNormKernel::configure(), ClComplexMulKernel::configure(), ClGemmLowpMatrixBReductionKernel::configure(), and CLComputeMeanVariance::configure().

405 {
406  opencl::ClKernelLibrary &klib = opencl::ClKernelLibrary::get();
407 
408  const std::string program_name = klib.program_name(kernel_name);
409  auto kernel_src = klib.program(program_name);
410  const std::string kernel_path = klib.kernel_path();
411 
412  return static_cast<cl::Kernel>(ctx.create_kernel(kernel_name, program_name, kernel_src.program, kernel_path, build_opts, kernel_src.is_binary));
413 }
std::string kernel_name

◆ create_lws_hint_parallel_implementations()

cl::NDRange create_lws_hint_parallel_implementations ( unsigned int  input_dimension,
unsigned int  vector_size 
)

Creates a suitable LWS hint object for parallel implementations.

Sets the number of WG based on the input size. If input width is smaller than 128 we can use fewer threads than 8.

Parameters
[in]input_dimensionnumber of elements along the dimension to apply the parallellization
[in]vector_sizesize of the vector in OpenCL
Returns
An LWS hint object

Definition at line 415 of file CLHelpers.cpp.

References arm_compute::utils::cast::U.

Referenced by CLArgMinMaxLayerKernel::configure().

416 {
417  const unsigned int width_leftover = input_dimension % vector_size;
418  const unsigned int border_width = (width_leftover != 0) ? vector_size - width_leftover : 0;
419  const unsigned int num_of_threads = ((input_dimension + border_width) / 16);
420  return cl::NDRange(std::min(8U, num_of_threads));
421 }

◆ create_opencl_context_and_device()

std::tuple< cl::Context, cl::Device, cl_int > create_opencl_context_and_device ( CLBackendType  cl_backend_type)

This function creates an OpenCL context and a device.

Note
In debug builds, the function will automatically enable cl_arm_printf if the driver/device supports it.
Parameters
[in]cl_backend_typeThe OpenCL backend type to use.
Returns
A std::tuple where the first element is the opencl context, the second element is the opencl device and the third one an error code. The error code will be CL_SUCCESS upon successful creation, otherwise a value telling why the function failed.

Definition at line 126 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_MSG, opencl_is_available(), and select_preferable_platform().

Referenced by CLRuntimeContext::CLRuntimeContext(), CLScheduler::default_init(), main(), and arm_compute::utils::run_example().

127 {
129  cl::Platform p = select_preferable_platform(cl_backend_type);
130  cl::Device device;
131  std::vector<cl::Device> platform_devices;
132  p.getDevices(CL_DEVICE_TYPE_DEFAULT, &platform_devices);
133  ARM_COMPUTE_ERROR_ON_MSG(platform_devices.size() == 0, "Couldn't find any OpenCL device");
134  device = platform_devices[0];
135  cl_int err = CL_SUCCESS;
136  std::array<cl_context_properties, 7> properties = { 0, 0, 0, 0, 0, 0, 0 };
137  initialise_context_properties(p, device, properties);
138  cl::Context cl_context = cl::Context(device, properties.data(), nullptr, nullptr, &err);
139  ARM_COMPUTE_ERROR_ON_MSG(err != CL_SUCCESS, "Failed to create OpenCL context");
140  return std::make_tuple(cl_context, device, err);
141 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
cl::Platform select_preferable_platform(CLBackendType cl_backend_type)
This function selects the OpenCL platform based on the backend type.
Definition: CLHelpers.cpp:88
bool opencl_is_available()
Check if OpenCL is available.
Definition: OpenCL.cpp:188

◆ create_window_iterator()

WindowIterator<L> arm_compute::create_window_iterator ( const Window w,
const Coordinates start,
const Coordinates end,
L &&  lambda_function 
)

Create a WindowIterator object.

Parameters
[in]wWindow to use for the iteration
[in]startWhere to start iterating from (In Window coordinates)
[in]endWhere to stop iterating (In Window coordinates).
[in]lambda_functionLambda function to call for every iteration between start and end. (It will be called last for end - 1)
Returns
A WindowIterator object.

Definition at line 313 of file WindowIterator.h.

References arm_compute::mlgo::parser::end(), and arm_compute::test::validation::w.

Referenced by DATA_TEST_CASE().

314 {
315  return WindowIterator<L>(w, start, end, std::move(lambda_function));
316 }
SimpleTensor< float > w
Definition: DFT.cpp:156
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

◆ data_layout_from_name()

arm_compute::DataLayout data_layout_from_name ( const std::string &  name)

Converts a string to a strong types enumeration DataLayout.

Parameters
[in]nameString to convert
Returns
Converted DataLayout enumeration

Definition at line 32 of file TypeLoader.cpp.

References NCHW, NHWC, and arm_compute::utility::tolower().

Referenced by operator>>().

33 {
34  static const std::map<std::string, arm_compute::DataLayout> data_layouts =
35  {
36  { "nhwc", DataLayout::NHWC },
37  { "nchw", DataLayout::NCHW },
38  };
39 
40 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
41  try
42  {
43 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
44  return data_layouts.at(arm_compute::utility::tolower(name));
45 
46 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
47  }
48  catch(const std::out_of_range &)
49  {
50  throw std::invalid_argument(name);
51  }
52 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
53 }
std::string tolower(std::string string)
Convert string to lower case.
Definition: Utility.h:205
const char * name

◆ data_size_from_type()

size_t arm_compute::data_size_from_type ( DataType  data_type)
inline

The size in bytes of the data type.

Parameters
[in]data_typeInput data type
Returns
The size in bytes of the data type

Definition at line 106 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, F64, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, SIZET, U16, U32, U64, and U8.

Referenced by ClPermuteKernel::configure(), CLStridedSliceKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClCastKernel::configure(), CLGatherKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLTileKernel::configure(), ClWeightsReshapeKernel::configure(), CLBatchToSpaceLayerKernel::configure(), TensorInfo::element_size(), arm_compute::cpu::l2_normalize_x(), arm_compute::cpu::l2_normalize_yz(), arm_compute::cpu::matrix_matrix_multiply_f32(), CpuGemmLowpMatrixMultiplyKernel::run_op(), and arm_compute::cpu::vector_matrix_multiply_f32().

107 {
108  switch(data_type)
109  {
110  case DataType::U8:
111  case DataType::S8:
112  case DataType::QSYMM8:
113  case DataType::QASYMM8:
114  case DataType::QASYMM8_SIGNED:
115  case DataType::QSYMM8_PER_CHANNEL:
116  return 1;
117  case DataType::U16:
118  case DataType::S16:
119  case DataType::QSYMM16:
120  case DataType::QASYMM16:
121  case DataType::BFLOAT16:
122  case DataType::F16:
123  return 2;
124  case DataType::F32:
125  case DataType::U32:
126  case DataType::S32:
127  return 4;
128  case DataType::F64:
129  case DataType::U64:
130  case DataType::S64:
131  return 8;
132  case DataType::SIZET:
133  return sizeof(size_t);
134  default:
135  ARM_COMPUTE_ERROR("Invalid data type");
136  return 0;
137  }
138 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ data_type_from_format()

DataType arm_compute::data_type_from_format ( Format  format)
inline

Return the data type used by a given single-planar pixel format.

Parameters
[in]formatInput format
Returns
The size in bytes of the pixel format

Definition at line 219 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UNKNOWN, UV88, UYVY422, YUV444, and YUYV422.

Referenced by SimpleTensor< uint8_t >::data_type(), TensorInfo::init(), TensorInfo::init_auto_padding(), and TensorInfo::set_format().

220 {
221  switch(format)
222  {
223  case Format::U8:
224  case Format::UV88:
225  case Format::RGB888:
226  case Format::RGBA8888:
227  case Format::YUYV422:
228  case Format::UYVY422:
229  return DataType::U8;
230  case Format::U16:
231  return DataType::U16;
232  case Format::S16:
233  return DataType::S16;
234  case Format::U32:
235  return DataType::U32;
236  case Format::S32:
237  return DataType::S32;
238  case Format::BFLOAT16:
239  return DataType::BFLOAT16;
240  case Format::F16:
241  return DataType::F16;
242  case Format::F32:
243  return DataType::F32;
244  //Doesn't make sense for planar formats:
245  case Format::NV12:
246  case Format::NV21:
247  case Format::IYUV:
248  case Format::YUV444:
249  default:
250  ARM_COMPUTE_ERROR("Not supported data_type for given format");
251  return DataType::UNKNOWN;
252  }
253 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ data_type_from_name()

DataType data_type_from_name ( const std::string &  name)

Convert a string to DataType.

Parameters
[in]nameThe name of the data type
Returns
DataType

Definition at line 328 of file Utils.cpp.

References ARM_COMPUTE_ERROR_VAR, F16, F32, QASYMM8, QASYMM8_SIGNED, and arm_compute::utility::tolower().

Referenced by is_symmetric(), and operator>>().

329 {
330  static const std::map<std::string, DataType> data_types =
331  {
332  { "f16", DataType::F16 },
333  { "f32", DataType::F32 },
334  { "qasymm8", DataType::QASYMM8 },
335  { "qasymm8_signed", DataType::QASYMM8_SIGNED },
336  };
337 
338 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
339  try
340  {
341 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
342  return data_types.at(utility::tolower(name));
343 
344 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
345  }
346  catch(const std::out_of_range &)
347  {
348  ARM_COMPUTE_ERROR_VAR("Invalid data type name: %s", name.c_str());
349  }
350 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
351 }
#define ARM_COMPUTE_ERROR_VAR(msg,...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:346
std::string tolower(std::string string)
Convert string to lower case.
Definition: Utility.h:205
const char * name

◆ deconvolution_output_dimensions()

std::pair< unsigned int, unsigned int > deconvolution_output_dimensions ( unsigned int  in_width,
unsigned int  in_height,
unsigned int  kernel_width,
unsigned int  kernel_height,
const PadStrideInfo pad_stride_info 
)

Returns expected width and height of the deconvolution's output tensor.

Parameters
[in]in_widthWidth of input tensor (Number of columns)
[in]in_heightHeight of input tensor (Number of rows)
[in]kernel_widthKernel width.
[in]kernel_heightKernel height.
[in]pad_stride_infoPad and stride information.
Returns
A pair with the new width in the first position and the new height in the second.

Definition at line 409 of file Utils.cpp.

References ARM_COMPUTE_ERROR_ON, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), PadStrideInfo::stride(), and arm_compute::test::validation::w.

Referenced by DeconvolutionLayerNode::compute_output_descriptor(), NEDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), permute_strides(), NEDeconvolutionLayer::validate(), CLGEMMDeconvolutionLayer::validate(), and CLDirectDeconvolutionLayer::validate().

412 {
413  const unsigned int pad_left = pad_stride_info.pad_left();
414  const unsigned int pad_top = pad_stride_info.pad_top();
415  const unsigned int pad_right = pad_stride_info.pad_right();
416  const unsigned int pad_bottom = pad_stride_info.pad_bottom();
417  const unsigned int stride_x = pad_stride_info.stride().first;
418  const unsigned int stride_y = pad_stride_info.stride().second;
419 
420  ARM_COMPUTE_ERROR_ON(in_width < 1 || in_height < 1);
421  ARM_COMPUTE_ERROR_ON(((in_width - 1) * stride_x + kernel_width) < (pad_left + pad_right));
422  ARM_COMPUTE_ERROR_ON(((in_height - 1) * stride_y + kernel_height) < (pad_top + pad_bottom));
423  const int w = stride_x * (in_width - 1) + kernel_width - (pad_left + pad_right);
424  const int h = stride_y * (in_height - 1) + kernel_height - (pad_top + pad_bottom);
425 
426  return std::make_pair<unsigned int, unsigned int>(w, h);
427 }
SimpleTensor< float > w
Definition: DFT.cpp:156
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466

◆ dequantize() [1/4]

float arm_compute::dequantize ( uint8_t  value,
float  scale,
int32_t  offset 
)
inline

Dequantize a value given an 8-bit asymmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]scaleScale to use for dequantization
[in]offsetZero-offset to use for dequantization
Returns
Dequantized value

Definition at line 385 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

386 {
387  return (static_cast<int>(value) - offset) * scale;
388 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ dequantize() [2/4]

float arm_compute::dequantize ( int8_t  value,
float  scale 
)
inline

Dequantize a value given a 8-bit symmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]scaleScale to use for dequantization
Returns
Dequantized value

Definition at line 460 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

461 {
462  return value * scale;
463 }

◆ dequantize() [3/4]

float arm_compute::dequantize ( int16_t  value,
float  scale 
)
inline

Dequantize a value given a 16-bit symmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]scaleScale to use for dequantization
Returns
Dequantized value

Definition at line 472 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

473 {
474  return value * scale;
475 }

◆ dequantize() [4/4]

float arm_compute::dequantize ( uint16_t  value,
float  scale,
int32_t  offset 
)
inline

Dequantize a value given a 16-bit asymmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]scaleScale to use for dequantization
[in]offsetZero-offset to use for dequantization
Returns
Dequantized value

Definition at line 485 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

486 {
487  return (static_cast<int>(value) - offset) * scale;
488 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ dequantize_qasymm16() [1/2]

float arm_compute::dequantize_qasymm16 ( uint16_t  value,
const UniformQuantizationInfo qinfo 
)
inline

Dequantize a value given a 16-bit asymmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 563 of file QuantizationInfo.h.

References UniformQuantizationInfo::offset, and UniformQuantizationInfo::scale.

Referenced by arm_compute::cpu::bounding_box_transform_qsymm16(), arm_compute::test::validation::convert_from_asymmetric(), dequantize_qasymm16(), and arm_compute::cpu::roi_align().

564 {
565  return (static_cast<int>(value) - qinfo.offset) * qinfo.scale;
566 }
const std::vector< int32_t > & offset() const
Offset vector accessor.
const std::vector< float > & scale() const
Scale vector accessor.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ dequantize_qasymm16() [2/2]

float arm_compute::dequantize_qasymm16 ( uint16_t  value,
const QuantizationInfo qinfo 
)
inline

Dequantize a value given a 16-bit asymmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 587 of file QuantizationInfo.h.

References dequantize_qasymm16(), and QuantizationInfo::uniform().

588 {
589  return dequantize_qasymm16(value, qinfo.uniform());
590 }
float dequantize_qasymm16(uint16_t value, const QuantizationInfo &qinfo)
Dequantize a value given a 16-bit asymmetric quantization scheme.
UniformQuantizationInfo uniform() const
Return per layer quantization info.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ dequantize_qasymm8()

float arm_compute::dequantize_qasymm8 ( uint8_t  value,
const INFO_TYPE &  qinfo 
)
inline

◆ dequantize_qasymm8_signed()

float arm_compute::dequantize_qasymm8_signed ( int8_t  value,
const INFO_TYPE &  qinfo 
)
inline

Dequantize a value given a signed 8-bit asymmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 372 of file QuantizationInfo.h.

References Qasymm8QuantizationHelper< QUANTIZED_TYPE >::dequantize().

Referenced by arm_compute::test::validation::convert_from_asymmetric(), arm_compute::scale_helpers::delta_bilinear_c1_quantized(), arm_compute::cpu::elementwise_comp_quantized_signed(), arm_compute::cpu::elementwise_op_quantized_signed(), arm_compute::cpu::neon_qasymm8_signed_activation(), qasymm8_signed_hard_swish(), qasymm8_signed_logistic(), arm_compute::cpu::roi_align_1x1_qasymm8(), CPPDetectionPostProcessLayer::run(), CpuConcatenateWidthKernel::run_op(), CpuConcatenateHeightKernel::run_op(), and arm_compute::test::validation::reference::scale().

373 {
375 }
float dequantize(uint16_t value, float scale, int32_t offset)
Dequantize a value given a 16-bit asymmetric quantization scheme.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ dequantize_qsymm16() [1/2]

float arm_compute::dequantize_qsymm16 ( int16_t  value,
const UniformQuantizationInfo qinfo 
)
inline

Dequantize a value given a 16-bit symmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 512 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

Referenced by arm_compute::cpu::compute_all_anchors_qasymm16(), arm_compute::test::validation::convert_from_symmetric(), dequantize_qsymm16(), and arm_compute::cpu::neon_qsymm16_activation().

513 {
514  return value * qinfo.scale;
515 }
const std::vector< float > & scale() const
Scale vector accessor.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ dequantize_qsymm16() [2/2]

float arm_compute::dequantize_qsymm16 ( int16_t  value,
const QuantizationInfo qinfo 
)
inline

Dequantize a value given a 16-bit symmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 536 of file QuantizationInfo.h.

References dequantize_qsymm16(), and QuantizationInfo::uniform().

537 {
538  return dequantize_qsymm16(value, qinfo.uniform());
539 }
float dequantize_qsymm16(int16_t value, const QuantizationInfo &qinfo)
Dequantize a value given a 16-bit symmetric quantization scheme.
UniformQuantizationInfo uniform() const
Return per layer quantization info.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ dequantize_qsymm8()

float arm_compute::dequantize_qsymm8 ( int8_t  value,
const UniformQuantizationInfo qinfo 
)
inline

Dequantize a value given a 8-bit symmetric quantization scheme.

Parameters
[in]valueValue to dequantize
[in]qinfoQuantization information to use for dequantizing
Returns
Dequantized value

Definition at line 397 of file QuantizationInfo.h.

References UniformQuantizationInfo::scale.

398 {
399  return value * qinfo.scale;
400 }
const std::vector< float > & scale() const
Scale vector accessor.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ device_supports_extension()

bool device_supports_extension ( const cl::Device &  device,
const char *  extension_name 
)

Helper function to check whether a given extension is supported.

Parameters
[in]deviceA CL device
[in]extension_nameName of the extension to be checked
Returns
True if the extension is supported

Definition at line 283 of file CLHelpers.cpp.

Referenced by arm_matrix_multiply_supported(), arm_non_uniform_workgroup_supported(), dot8_acc_supported(), dot8_supported(), fp16_supported(), image2d_from_buffer_supported(), and arm_compute::test::validation::TEST_CASE().

284 {
285  std::string extensions = device.getInfo<CL_DEVICE_EXTENSIONS>();
286  auto pos = extensions.find(extension_name);
287  return (pos != std::string::npos);
288 }

◆ DIV_CEIL()

constexpr auto arm_compute::DIV_CEIL ( val,
m 
) -> decltype((val + m - 1) / m)

Calculate the rounded up quotient of val / m.

Parameters
[in]valValue to divide and round up.
[in]mValue to divide by.
Returns
the result.

Definition at line 58 of file Utils.h.

References arm_compute::test::validation::m.

Referenced by ceil_to_multiple().

59 {
60  return (val + m - 1) / m;
61 }

◆ dot8_acc_supported()

bool dot8_acc_supported ( const cl::Device &  device)

Helper function to check whether the cl_arm_integer_dot_product_accumulate_int8 extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 251 of file CLHelpers.cpp.

References device_supports_extension().

252 {
253  return device_supports_extension(device, "cl_arm_integer_dot_product_accumulate_int8");
254 }
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283

◆ dot8_supported()

bool dot8_supported ( const cl::Device &  device)

Helper function to check whether the cl_arm_integer_dot_product_int8 extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 241 of file CLHelpers.cpp.

References device_supports_extension(), G76, and get_target_from_name().

Referenced by ClGemmDefaultConfigNativeBifrost::configure(), ClGemmDefaultConfigReshapedRhsOnlyBifrost::configure(), ClGemmDefaultConfigReshapedBifrost::configure(), ClGemmDefaultConfigNativeValhall::configure(), ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), and ClGemmLowpMatrixAReductionKernel::configure().

242 {
243  std::string device_name = device.getInfo<CL_DEVICE_NAME>();
244  const GPUTarget gpu_target = get_target_from_name(device_name);
245 
246  // SW_WORKAROUND: Workaround for DDK revision r14p0.to enable cl_arm_integer_dot_product_int8
247  std::set<GPUTarget> sw_workaround_issue = { GPUTarget::G76 };
248  return (device_supports_extension(device, "cl_arm_integer_dot_product_int8") || sw_workaround_issue.count(gpu_target) != 0);
249 }
GPUTarget get_target_from_name(const std::string &device_name)
Helper function to get the GPU target from a device name.
Definition: GPUTarget.cpp:186
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34

◆ element_size_from_data_type()

size_t arm_compute::element_size_from_data_type ( DataType  dt)
inline

The size in bytes of the data type.

Parameters
[in]dtInput data type
Returns
The size in bytes of the data type

Definition at line 185 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S8, U16, U32, and U8.

Referenced by CLPadLayerKernel::configure(), arm_compute::test::validation::reference::depth_convert(), SimpleTensor< uint8_t >::element_size(), and arm_compute::test::validation::validate().

186 {
187  switch(dt)
188  {
189  case DataType::S8:
190  case DataType::U8:
191  case DataType::QSYMM8:
192  case DataType::QASYMM8:
193  case DataType::QASYMM8_SIGNED:
194  case DataType::QSYMM8_PER_CHANNEL:
195  return 1;
196  case DataType::U16:
197  case DataType::S16:
198  case DataType::QSYMM16:
199  case DataType::QASYMM16:
200  case DataType::BFLOAT16:
201  case DataType::F16:
202  return 2;
203  case DataType::U32:
204  case DataType::S32:
205  case DataType::F32:
206  return 4;
207  default:
208  ARM_COMPUTE_ERROR("Undefined element size for given data type");
209  return 0;
210  }
211 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ enqueue()

void enqueue ( cl::CommandQueue &  queue,
ICLKernel kernel,
const Window window,
const cl::NDRange &  lws_hint = CLKernelLibrary::get().default_ndrange(),
bool  use_dummy_work_items = false 
)

Add the kernel to the command queue with the given window.

Note
Depending on the size of the window, this might translate into several jobs being enqueued.
If kernel->kernel() is empty then the function will return without adding anything to the queue.
Parameters
[in,out]queueOpenCL command queue.
[in]kernelKernel to enqueue
[in]windowWindow the kernel has to process.
[in]lws_hint(Optional) Local workgroup size requested. Default is based on the device target.
[in]use_dummy_work_items(Optional) Use dummy work items in order to have two dimensional power of two NDRange. Default is false Note: it is kernel responsibility to check if the work-item is out-of-range
Note
If any dimension of the lws is greater than the global workgroup size then no lws will be passed.

Definition at line 32 of file ICLKernel.cpp.

References ARM_COMPUTE_ERROR_ON, arm_compute::mlgo::parser::end(), ICLKernel::get_max_workgroup_size(), get_next_power_two(), ICLKernel::kernel(), set_wbsm(), arm_compute::cpu::step, and ICLKernel::wbsm_hint().

Referenced by ICLKernel::get_target(), ICLSimple2DKernel::run(), ICLSimple3DKernel::run(), CLBitwiseKernel::run(), CLChannelShuffleLayerKernel::run(), CLInstanceNormalizationLayerKernel::run(), CLReverseKernel::run(), CLSelectKernel::run(), CLSpaceToDepthLayerKernel::run(), CLDepthToSpaceLayerKernel::run(), CLDeconvolutionLayerUpsampleKernel::run(), CLFFTScaleKernel::run(), CLComputeAllAnchorsKernel::run(), CLMaxUnpoolingLayerKernel::run(), CLQLSTMLayerNormalizationKernel::run(), CLROIPoolingLayerKernel::run(), CLGatherKernel::run(), CLComparisonKernel::run(), CLNormalizationLayerKernel::run(), CLTileKernel::run(), CLFFTDigitReverseKernel::run(), CLMeanStdDevNormalizationKernel::run(), CLRangeKernel::run(), CLReorgLayerKernel::run(), CLReductionOperationKernel::run(), CLNormalizePlanarYUVLayerKernel::run(), CLPadLayerKernel::run(), CLPriorBoxLayerKernel::run(), CLFFTRadixStageKernel::run(), CLFillBorderKernel::run(), CLL2NormalizeLayerKernel::run(), CLBoundingBoxTransformKernel::run(), CLStackLayerKernel::run(), CLArgMinMaxLayerKernel::run(), CLDepthwiseConvolutionLayerNativeKernel::run(), CLROIAlignLayerKernel::run(), CLDeconvolutionReshapeOutputKernel::run(), CLBatchToSpaceLayerKernel::run(), CLBatchNormalizationLayerKernel::run(), CLFuseBatchNormalizationKernel::run(), CLSpaceToBatchLayerKernel::run(), CLComputeMeanVariance::run(), ClCompositeKernel::run_composite_op(), ClElementwiseKernel::run_op(), ClKernelRuntime::run_op(), ClReshapeKernel::run_op(), ClTransposeKernel::run_op(), ClDequantizeKernel::run_op(), ClFloorKernel::run_op(), ClCopyKernel::run_op(), ClElementWiseUnaryKernel::run_op(), ClFillKernel::run_op(), ClWidthConcatenate2TensorsKernel::run_op(), ClScaleKernel::run_op(), ClHeightConcatenateKernel::run_op(), ClActivationKernel::run_op(), ClPool3dKernel::run_op(), ClPool2dKernel::run_op(), ClWidthConcatenateKernel::run_op(), ClQuantizeKernel::run_op(), ClWidthConcatenate4TensorsKernel::run_op(), ClPermuteKernel::run_op(), ClBatchConcatenateKernel::run_op(), ClDepthConcatenateKernel::run_op(), ClCropKernel::run_op(), ClConvertFullyConnectedWeightsKernel::run_op(), ClGemmReshapeLhsMatrixKernel::run_op(), ClGemmLowpMatrixMultiplyNativeKernel::run_op(), ClWinogradInputTransformKernel::run_op(), ClWinogradFilterTransformKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleKernel::run_op(), ClCastKernel::run_op(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::run_op(), ClWinogradOutputTransformKernel::run_op(), ClGemmMatrixMultiplyNativeKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::run_op(), CLStridedSliceKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedKernel::run_op(), ClGemmReshapeRhsMatrixKernel::run_op(), ClGemmLowpOffsetContributionKernel::run_op(), ClCol2ImKernel::run_op(), ClGemmLowpOffsetContributionOutputStageKernel::run_op(), ClDirectConv2dKernel::run_op(), ClDirectConv3dKernel::run_op(), ClLogits1DMaxShiftExpSumKernel::run_op(), ClMulKernel::run_op(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::run_op(), ClGemmLowpMatrixAReductionKernel::run_op(), ClWeightsReshapeKernel::run_op(), CLFillBorderKernel::run_op(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::run_op(), ClIm2ColKernel::run_op(), ClGemmMatrixMultiplyReshapedKernel::run_op(), ClComplexMulKernel::run_op(), ClLogits1DNormKernel::run_op(), and ClGemmLowpMatrixBReductionKernel::run_op().

33 {
34  if(kernel.kernel()() == nullptr)
35  {
36  return;
37  }
38 
39  for(unsigned int i = 0; i < Coordinates::num_max_dimensions; ++i)
40  {
41  ARM_COMPUTE_ERROR_ON(window[i].step() == 0);
42  // Make sure that dimensions > Z are 1
43  ARM_COMPUTE_ERROR_ON((i >= 3) && ((window[i].end() - window[i].start()) != 1));
44  }
45 
46  cl::NDRange gws = ICLKernel::gws_from_window(window);
47 
48  // Check for empty NDRange
49  if(gws.dimensions() == 0)
50  {
51  return;
52  }
53 
54  // Use dummy work-items
55  if(use_dummy_work_items)
56  {
57  gws.get()[0] = get_next_power_two(gws[0]);
58  gws.get()[1] = get_next_power_two(gws[1]);
59  }
60 
61  cl::NDRange valid_lws;
62  if(lws_hint[0] * lws_hint[1] * lws_hint[2] > kernel.get_max_workgroup_size())
63  {
64  valid_lws = cl::NullRange;
65  }
66  else
67  {
68  valid_lws = lws_hint;
69  }
70 
71  cl::NDRange lws = cl::NullRange;
72 
73  if((valid_lws[0] <= gws[0]) && (valid_lws[1] <= gws[1]) && (valid_lws[2] <= gws[2]))
74  {
75  lws = valid_lws;
76  }
77 
78  if(CLKernelLibrary::get().is_wbsm_supported())
79  {
80  set_wbsm(kernel.kernel(), kernel.wbsm_hint());
81  }
82  queue.enqueueNDRangeKernel(kernel.kernel(), cl::NullRange, gws, lws);
83 }
unsigned int get_next_power_two(unsigned int x)
Given an integer value, this function returns the next power of two.
Definition: Utils.h:74
void set_wbsm(cl::Kernel &kernel, cl_int wbsm_hint)
Definition: CLHelpers.cpp:434
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35

◆ error_on_channel_not_in()

arm_compute::Status arm_compute::error_on_channel_not_in ( const char *  function,
const char *  file,
const int  line,
cn,
T &&  channel,
Ts &&...  channels 
)
inline

Return an error if the channel is not in channels.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]cnInput channel
[in]channelFirst channel allowed.
[in]channels(Optional) Further allowed channels.
Returns
Status

Definition at line 869 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, and UNKNOWN.

Referenced by error_on_channel_not_in_known_format().

871 {
872  ARM_COMPUTE_RETURN_ERROR_ON_LOC(cn == Channel::UNKNOWN, function, file, line);
873 
874  const std::array<T, sizeof...(Ts)> channels_array{ { std::forward<Ts>(channels)... } };
875  ARM_COMPUTE_RETURN_ERROR_ON_LOC(channel != cn && std::none_of(channels_array.begin(), channels_array.end(), [&](const T & f)
876  {
877  return f == cn;
878  }),
879  function, file, line);
880  return arm_compute::Status{};
881 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52

◆ error_on_channel_not_in_known_format()

arm_compute::Status error_on_channel_not_in_known_format ( const char *  function,
const char *  file,
const int  line,
arm_compute::Format  fmt,
arm_compute::Channel  cn 
)

Return an error if the channel is not in format.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]fmtInput channel
[in]cnFirst channel allowed.
Returns
Status

Definition at line 113 of file Validate.cpp.

References A, ARM_COMPUTE_ERROR_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC, B, error_on_channel_not_in(), G, IYUV, NV12, NV21, R, RGB888, RGBA8888, U, UNKNOWN, UV88, UYVY422, V, Y, YUV444, and YUYV422.

115 {
118 
119  switch(fmt)
120  {
123  break;
126  break;
129  break;
137  break;
138  default:
139  ARM_COMPUTE_ERROR_LOC(function, file, line, "Not supported format.");
140  }
141  return arm_compute::Status{};
142 }
A single plane of 32-bit macro pixel of U0, Y0, V0, Y1 byte.
Cr/V/Value channel.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
A 2 plane YUV format of Luma (Y) and interleaved UV data at 4:2:0 sampling.
Status class.
Definition: Error.h:52
A 2 plane YUV format of Luma (Y) and interleaved VU data at 4:2:0 sampling.
3 channels, 1 U8 per channel
arm_compute::Status error_on_channel_not_in(const char *function, const char *file, const int line, T cn, T &&channel, Ts &&... channels)
Return an error if the channel is not in channels.
Definition: Validate.h:869
#define ARM_COMPUTE_ERROR_LOC(func, file, line, msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:372
A 3 plane of 8 bit 4:4:4 sampled Y, U, V planes.
A 3 plane of 8-bit 4:2:0 sampled Y, U, V planes.
4 channels, 1 U8 per channel
2 channel, 1 U8 per channel
A single plane of 32-bit macro pixel of Y0, U0, Y1, V0 bytes.

◆ error_on_coordinates_dimensions_gte()

arm_compute::Status error_on_coordinates_dimensions_gte ( const char *  function,
const char *  file,
const int  line,
const Coordinates pos,
unsigned int  max_dim 
)

Return an error if the passed coordinates have too many dimensions.

The coordinates have too many dimensions if any of the dimensions greater or equal to max_dim is different from 0.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]posCoordinates to validate
[in]max_dimMaximum number of dimensions allowed.
Returns
Status

Definition at line 70 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, and Dimensions< int >::num_max_dimensions.

72 {
73  for(unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i)
74  {
75  ARM_COMPUTE_RETURN_ERROR_ON_LOC(pos[i] != 0, function, file, line);
76  }
77  return arm_compute::Status{};
78 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Definition: Dimensions.h:46

◆ error_on_data_layout_not_in() [1/2]

arm_compute::Status arm_compute::error_on_data_layout_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
T &&  dl,
Ts &&...  dls 
)
inline

Return an error if the data layout of the passed tensor info does not match any of the data layouts provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
[in]dlFirst data layout allowed.
[in]dls(Optional) Further allowed data layouts.
Returns
Status

Definition at line 705 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, ITensorInfo::data_layout(), dl, string_from_data_layout(), and UNKNOWN.

Referenced by error_on_data_layout_not_in().

707 {
708  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
709 
710  const DataLayout &tensor_dl = tensor_info->data_layout(); //NOLINT
711  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_dl == DataLayout::UNKNOWN, function, file, line);
712 
713  const std::array<T, sizeof...(Ts)> dls_array{ { std::forward<Ts>(dls)... } };
714  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor_dl != dl && std::none_of(dls_array.begin(), dls_array.end(), [&](const T & l)
715  {
716  return l == tensor_dl;
717  }),
718  function, file, line, "ITensor data layout %s not supported by this kernel", string_from_data_layout(tensor_dl).c_str());
719  return arm_compute::Status{};
720 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
Definition: Utils.cpp:123
DataLayout
[DataLayout enum definition]
Definition: Types.h:113

◆ error_on_data_layout_not_in() [2/2]

arm_compute::Status arm_compute::error_on_data_layout_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
T &&  dl,
Ts &&...  dls 
)
inline

Return an error if the data layout of the passed tensor does not match any of the data layout provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
[in]dlFirst data layout allowed.
[in]dls(Optional) Further allowed data layouts.
Returns
Status

Definition at line 733 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, dl, error_on_data_layout_not_in(), and ITensor::info().

735 {
736  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
737  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_data_layout_not_in(function, file, line, tensor->info(), std::forward<T>(dl), std::forward<Ts>(dls)...));
738  return arm_compute::Status{};
739 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
arm_compute::Status error_on_data_layout_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dl, Ts &&... dls)
Return an error if the data layout of the passed tensor info does not match any of the data layouts p...
Definition: Validate.h:705
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_data_type_channel_not_in() [1/2]

arm_compute::Status arm_compute::error_on_data_type_channel_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
size_t  num_channels,
T &&  dt,
Ts &&...  dts 
)
inline

Return an error if the data type or the number of channels of the passed tensor info does not match any of the data types and number of channels provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
[in]num_channelsNumber of channels to check
[in]dtFirst data type allowed.
[in]dts(Optional) Further allowed data types.
Returns
Status

Definition at line 758 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, ARM_COMPUTE_RETURN_ON_ERROR, dt, error_on_data_type_not_in(), and ITensorInfo::num_channels().

Referenced by error_on_data_type_channel_not_in().

760 {
761  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_data_type_not_in(function, file, line, tensor_info, std::forward<T>(dt), std::forward<Ts>(dts)...));
762  const size_t tensor_nc = tensor_info->num_channels();
763  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor_nc != num_channels, function, file, line, "Number of channels %zu. Required number of channels %zu", tensor_nc, num_channels);
764  return arm_compute::Status{};
765 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263
arm_compute::Status error_on_data_type_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dt, Ts &&... dts)
Return an error if the data type of the passed tensor info does not match any of the data types provi...
Definition: Validate.h:653

◆ error_on_data_type_channel_not_in() [2/2]

arm_compute::Status arm_compute::error_on_data_type_channel_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
size_t  num_channels,
T &&  dt,
Ts &&...  dts 
)
inline

Return an error if the data type or the number of channels of the passed tensor does not match any of the data types and number of channels provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
[in]num_channelsNumber of channels to check
[in]dtFirst data type allowed.
[in]dts(Optional) Further allowed data types.
Returns
Status

Definition at line 779 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, dt, error_on_data_type_channel_not_in(), and ITensor::info().

781 {
782  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
783  ARM_COMPUTE_RETURN_ON_ERROR(error_on_data_type_channel_not_in(function, file, line, tensor->info(), num_channels, std::forward<T>(dt), std::forward<Ts>(dts)...));
784  return arm_compute::Status{};
785 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_data_type_channel_not_in(const char *function, const char *file, const int line, const ITensor *tensor, size_t num_channels, T &&dt, Ts &&... dts)
Return an error if the data type or the number of channels of the passed tensor does not match any of...
Definition: Validate.h:779
Status class.
Definition: Error.h:52
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_data_type_not_in() [1/2]

arm_compute::Status arm_compute::error_on_data_type_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
T &&  dt,
Ts &&...  dts 
)
inline

Return an error if the data type of the passed tensor info does not match any of the data types provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
[in]dtFirst data type allowed.
[in]dts(Optional) Further allowed data types.
Returns
Status

Definition at line 653 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, ITensorInfo::data_type(), dt, string_from_data_type(), and UNKNOWN.

Referenced by error_on_data_type_channel_not_in(), and error_on_data_type_not_in().

655 {
656  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
657 
658  const DataType &tensor_dt = tensor_info->data_type(); //NOLINT
659  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_dt == DataType::UNKNOWN, function, file, line);
660 
661  const std::array<T, sizeof...(Ts)> dts_array{ { std::forward<Ts>(dts)... } };
662  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor_dt != dt && std::none_of(dts_array.begin(), dts_array.end(), [&](const T & d)
663  {
664  return d == tensor_dt;
665  }),
666  function, file, line, "ITensor data type %s not supported by this kernel", string_from_data_type(tensor_dt).c_str());
667  return arm_compute::Status{};
668 }
DataType
Definition: Acl.hpp:485
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Definition: Utils.cpp:135
TensorInfo tensor_info
Associated tensor info.
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263

◆ error_on_data_type_not_in() [2/2]

arm_compute::Status arm_compute::error_on_data_type_not_in ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
T &&  dt,
Ts &&...  dts 
)
inline

Return an error if the data type of the passed tensor does not match any of the data types provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
[in]dtFirst data type allowed.
[in]dts(Optional) Further allowed data types.
Returns
Status

Definition at line 681 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, dt, error_on_data_type_not_in(), and ITensor::info().

683 {
684  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
685  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_data_type_not_in(function, file, line, tensor->info(), std::forward<T>(dt), std::forward<Ts>(dts)...));
686  return arm_compute::Status{};
687 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
arm_compute::Status error_on_data_type_not_in(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, T &&dt, Ts &&... dts)
Return an error if the data type of the passed tensor info does not match any of the data types provi...
Definition: Validate.h:653
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_format_not_in()

void arm_compute::error_on_format_not_in ( const char *  function,
const char *  file,
const int  line,
const T *  object,
F &&  format,
Fs &&...  formats 
)

Throw an error if the format of the passed tensor/multi-image does not match any of the formats provided.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]objectTensor/multi-image to validate.
[in]formatFirst format allowed.
[in]formats(Optional) Further allowed formats.

Definition at line 619 of file Validate.h.

References ARM_COMPUTE_ERROR_ON_LOC, ARM_COMPUTE_ERROR_ON_LOC_MSG, ARM_COMPUTE_UNUSED, string_from_format(), and UNKNOWN.

621 {
622  ARM_COMPUTE_ERROR_ON_LOC(object == nullptr, function, file, line);
623 
624  Format &&object_format = object->info()->format();
625  ARM_COMPUTE_UNUSED(object_format);
626 
627  ARM_COMPUTE_ERROR_ON_LOC(object_format == Format::UNKNOWN, function, file, line);
628 
629  const std::array<F, sizeof...(Fs)> formats_array{ { std::forward<Fs>(formats)... } };
630  ARM_COMPUTE_UNUSED(formats_array);
631 
632  ARM_COMPUTE_ERROR_ON_LOC_MSG(object_format != format && std::none_of(formats_array.begin(), formats_array.end(), [&](const F & f)
633  {
634  return f == object_format;
635  }),
636  function, file, line, "Format %s not supported by this kernel", string_from_format(object_format).c_str());
637  ARM_COMPUTE_UNUSED(function, format, file, line);
638 }
#define ARM_COMPUTE_ERROR_ON_LOC_MSG(cond, func, file, line,...)
Definition: Error.h:458
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
Format
Image colour formats.
Definition: Types.h:56
#define ARM_COMPUTE_ERROR_ON_LOC(cond, func, file, line)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:476
const std::string & string_from_format(Format format)
Convert a tensor format into a string.
Definition: Utils.cpp:76

◆ error_on_invalid_subtensor()

arm_compute::Status error_on_invalid_subtensor ( const char *  function,
const char *  file,
const int  line,
const TensorShape parent_shape,
const Coordinates coords,
const TensorShape shape 
)

Return an error if if the coordinates and shape of the subtensor are within the parent tensor.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]parent_shapeParent tensor shape
[in]coordsCoordinates inside the parent tensor where the first element of the subtensor is
[in]shapeShape of the subtensor
Returns
Status

Definition at line 154 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC.

156 {
157  // Check dimensions
158  for(unsigned int i = 0; i < TensorShape::num_max_dimensions; ++i)
159  {
160  const bool invalid_idx = coords[i] >= static_cast<int>(parent_shape[i]);
161  const bool out_of_bounds_size = coords[i] + static_cast<int>(shape[i]) > static_cast<int>(parent_shape[i]);
162  ARM_COMPUTE_RETURN_ERROR_ON_LOC(invalid_idx || out_of_bounds_size, function, file, line);
163  }
164  return arm_compute::Status{};
165 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52

◆ error_on_invalid_subtensor_valid_region()

arm_compute::Status error_on_invalid_subtensor_valid_region ( const char *  function,
const char *  file,
const int  line,
const ValidRegion parent_valid_region,
const ValidRegion valid_region 
)

Return an error if the valid region of a subtensor is not inside the valid region of the parent tensor.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]parent_valid_regionParent valid region.
[in]valid_regionValid region of subtensor.
Returns
Status

Definition at line 167 of file Validate.cpp.

References ValidRegion::anchor, ARM_COMPUTE_RETURN_ERROR_ON_LOC, and ValidRegion::shape.

169 {
170  // Check valid regions
171  for(unsigned int d = 0; d < TensorShape::num_max_dimensions; ++d)
172  {
173  ARM_COMPUTE_RETURN_ERROR_ON_LOC((parent_valid_region.anchor[d] > valid_region.anchor[d]), function, file, line);
174  ARM_COMPUTE_RETURN_ERROR_ON_LOC((parent_valid_region.anchor[d] + static_cast<int>(parent_valid_region.shape[d])) < (valid_region.anchor[d] + static_cast<int>(valid_region.shape[d])),
175  function, file, line);
176  }
177 
178  return arm_compute::Status{};
179 }
TensorShape shape
Shape of the valid region.
Definition: Types.h:266
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
const ValidRegion valid_region
Definition: Scale.cpp:214
Coordinates anchor
Anchor for the start of the valid region.
Definition: Types.h:265

◆ error_on_invalid_subwindow()

arm_compute::Status error_on_invalid_subwindow ( const char *  function,
const char *  file,
const int  line,
const Window full,
const Window sub 
)

Return an error if the passed subwindow is invalid.

The subwindow is invalid if:

  • It is not a valid window.
  • It is not fully contained inside the full window
  • The step for each of its dimension is not identical to the corresponding one of the full window.
Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]fullFull size window
[in]subSub-window to validate.
Returns
Status

Definition at line 41 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, arm_compute::mlgo::parser::end(), Dimensions< int >::num_max_dimensions, arm_compute::cpu::step, and Window::validate().

43 {
44  full.validate();
45  sub.validate();
46 
47  for(size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i)
48  {
49  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].start() > sub[i].start(), function, file, line);
50  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].end() < sub[i].end(), function, file, line);
51  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].step() != sub[i].step(), function, file, line);
52  ARM_COMPUTE_RETURN_ERROR_ON_LOC((sub[i].start() - full[i].start()) % sub[i].step(), function, file, line);
53  }
54  return arm_compute::Status{};
55 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Definition: Dimensions.h:46

◆ error_on_mismatching_data_layouts() [1/2]

arm_compute::Status arm_compute::error_on_mismatching_data_layouts ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
Ts...  tensor_infos 
)
inline

Return an error if the passed tensor infos have different data layouts.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoThe first tensor info to be compared.
[in]tensor_infos(Optional) Further allowed tensor infos.
Returns
Status

Definition at line 453 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ARM_COMPUTE_RETURN_ON_ERROR, ITensorInfo::data_layout(), and error_on_nullptr().

Referenced by error_on_mismatching_data_layouts().

455 {
456  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
457  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensor_infos)...));
458 
459  DataLayout &&tensor_data_layout = tensor_info->data_layout();
460  const std::array<const ITensorInfo *, sizeof...(Ts)> tensors_infos_array{ { std::forward<Ts>(tensor_infos)... } };
461  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensors_infos_array.begin(), tensors_infos_array.end(), [&](const ITensorInfo * tensor_info_obj)
462  {
463  return tensor_info_obj->data_layout() != tensor_data_layout;
464  }),
465  function, file, line, "Tensors have different data layouts");
466  return arm_compute::Status{};
467 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.
DataLayout
[DataLayout enum definition]
Definition: Types.h:113

◆ error_on_mismatching_data_layouts() [2/2]

arm_compute::Status arm_compute::error_on_mismatching_data_layouts ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
Ts...  tensors 
)
inline

Return an error if the passed tensors have different data layouts.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorThe first tensor to be compared.
[in]tensors(Optional) Further allowed tensors.
Returns
Status

Definition at line 479 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_mismatching_data_layouts(), error_on_nullptr(), and ITensor::info().

481 {
482  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
483  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensors)...));
485  detail::get_tensor_info_t<ITensorInfo *>()(tensors)...));
486  return arm_compute::Status{};
487 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
CLTensor * tensor
Pointer to the auxiliary tensor.
arm_compute::Status error_on_mismatching_data_layouts(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
Return an error if the passed tensor infos have different data layouts.
Definition: Validate.h:453

◆ error_on_mismatching_data_types() [1/2]

arm_compute::Status arm_compute::error_on_mismatching_data_types ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
Ts...  tensor_infos 
)
inline

Return an error if the passed two tensor infos have different data types.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoThe first tensor info to be compared.
[in]tensor_infos(Optional) Further allowed tensor infos.
Returns
Status

Definition at line 504 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ARM_COMPUTE_RETURN_ON_ERROR, ITensorInfo::data_type(), and error_on_nullptr().

Referenced by error_on_mismatching_data_types().

506 {
507  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
508  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensor_infos)...));
509 
510  DataType &&tensor_data_type = tensor_info->data_type();
511  const std::array<const ITensorInfo *, sizeof...(Ts)> tensors_infos_array{ { std::forward<Ts>(tensor_infos)... } };
512  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensors_infos_array.begin(), tensors_infos_array.end(), [&](const ITensorInfo * tensor_info_obj)
513  {
514  return tensor_info_obj->data_type() != tensor_data_type;
515  }),
516  function, file, line, "Tensors have different data types");
517  return arm_compute::Status{};
518 }
DataType
Definition: Acl.hpp:485
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.

◆ error_on_mismatching_data_types() [2/2]

arm_compute::Status arm_compute::error_on_mismatching_data_types ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
Ts...  tensors 
)
inline

Return an error if the passed two tensors have different data types.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorThe first tensor to be compared.
[in]tensors(Optional) Further allowed tensors.
Returns
Status

Definition at line 530 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_mismatching_data_types(), error_on_nullptr(), and ITensor::info().

532 {
533  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
534  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensors)...));
536  detail::get_tensor_info_t<ITensorInfo *>()(tensors)...));
537  return arm_compute::Status{};
538 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
arm_compute::Status error_on_mismatching_data_types(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, Ts... tensor_infos)
Return an error if the passed two tensor infos have different data types.
Definition: Validate.h:504
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_mismatching_dimensions()

arm_compute::Status arm_compute::error_on_mismatching_dimensions ( const char *  function,
const char *  file,
int  line,
const Dimensions< T > &  dim1,
const Dimensions< T > &  dim2,
Ts &&...  dims 
)

Return an error if the passed dimension objects differ.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]dim1The first object to be compared.
[in]dim2The second object to be compared.
[in]dims(Optional) Further allowed objects.
Returns
Status

Definition at line 276 of file Validate.h.

References ARM_COMPUTE_RETURN_ON_ERROR, and arm_compute::detail::for_each_error().

278 {
279  ARM_COMPUTE_RETURN_ON_ERROR(detail::for_each_error(detail::compare_dimension<T>(dim1, function, file, line), dim2, std::forward<Ts>(dims)...));
280  return arm_compute::Status{};
281 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
arm_compute::Status for_each_error(F &&func, T &&arg, Ts &&... args)
Definition: Validate.h:110

◆ error_on_mismatching_quantization_info() [1/2]

arm_compute::Status arm_compute::error_on_mismatching_quantization_info ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info_1,
const ITensorInfo tensor_info_2,
Ts...  tensor_infos 
)
inline

Return an error if the passed tensor infos have different asymmetric quantized data types or different quantization info.

Note
: If the first tensor info doesn't have asymmetric quantized data type, the function returns without throwing an error
Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_info_1The first tensor info to be compared.
[in]tensor_info_2The second tensor info to be compared.
[in]tensor_infos(Optional) Further allowed tensor infos.
Returns
Status

Definition at line 558 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ITensorInfo::data_type(), is_data_type_quantized(), ITensorInfo::quantization_info(), and tensor_info.

Referenced by error_on_mismatching_quantization_info().

560 {
561  DataType &&first_data_type = tensor_info_1->data_type();
562  const QuantizationInfo first_quantization_info = tensor_info_1->quantization_info();
563 
564  if(!is_data_type_quantized(first_data_type))
565  {
566  return arm_compute::Status{};
567  }
568 
569  const std::array < const ITensorInfo *, 1 + sizeof...(Ts) > tensor_infos_array{ { tensor_info_2, std::forward<Ts>(tensor_infos)... } };
570  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensor_infos_array.begin(), tensor_infos_array.end(), [&](const ITensorInfo * tensor_info)
571  {
572  return tensor_info->data_type() != first_data_type;
573  }),
574  function, file, line, "Tensors have different asymmetric quantized data types");
575  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensor_infos_array.begin(), tensor_infos_array.end(), [&](const ITensorInfo * tensor_info)
576  {
577  return tensor_info->quantization_info() != first_quantization_info;
578  }),
579  function, file, line, "Tensors have different quantization information");
580 
581  return arm_compute::Status{};
582 }
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Definition: Utils.h:1030
DataType
Definition: Acl.hpp:485
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.

◆ error_on_mismatching_quantization_info() [2/2]

arm_compute::Status arm_compute::error_on_mismatching_quantization_info ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor_1,
const ITensor tensor_2,
Ts...  tensors 
)
inline

Return an error if the passed tensor have different asymmetric quantized data types or different quantization info.

Note
: If the first tensor doesn't have asymmetric quantized data type, the function returns without throwing an error
Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_1The first tensor to be compared.
[in]tensor_2The second tensor to be compared.
[in]tensors(Optional) Further allowed tensors.
Returns
Status

Definition at line 597 of file Validate.h.

References ARM_COMPUTE_RETURN_ON_ERROR, error_on_mismatching_quantization_info(), and ITensor::info().

599 {
600  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_mismatching_quantization_info(function, file, line, tensor_1->info(), tensor_2->info(),
601  detail::get_tensor_info_t<ITensorInfo *>()(tensors)...));
602  return arm_compute::Status{};
603 }
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status class.
Definition: Error.h:52
arm_compute::Status error_on_mismatching_quantization_info(const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
Return an error if the passed tensor infos have different asymmetric quantized data types or differen...
Definition: Validate.h:558

◆ error_on_mismatching_shapes() [1/4]

arm_compute::Status arm_compute::error_on_mismatching_shapes ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info_1,
const ITensorInfo tensor_info_2,
Ts...  tensor_infos 
)
inline

Return an error if the passed two tensor infos have different shapes from the given dimension.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_info_1The first tensor info to be compared.
[in]tensor_info_2The second tensor info to be compared.
[in]tensor_infos(Optional) Further allowed tensor infos.
Returns
Status

Definition at line 364 of file Validate.h.

References arm_compute::utils::cast::U.

Referenced by error_on_mismatching_shapes().

366 {
367  return error_on_mismatching_shapes(function, file, line, 0U, tensor_info_1, tensor_info_2, std::forward<Ts>(tensor_infos)...);
368 }
arm_compute::Status error_on_mismatching_shapes(const char *function, const char *file, const int line, unsigned int upper_dim, const ITensor *tensor_1, const ITensor *tensor_2, Ts... tensors)
Return an error if the passed two tensors have different shapes from the given dimension.
Definition: Validate.h:427

◆ error_on_mismatching_shapes() [2/4]

arm_compute::Status arm_compute::error_on_mismatching_shapes ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor_1,
const ITensor tensor_2,
Ts...  tensors 
)
inline

Return an error if the passed two tensors have different shapes from the given dimension.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_1The first tensor to be compared.
[in]tensor_2The second tensor to be compared.
[in]tensors(Optional) Further allowed tensors.
Returns
Status

Definition at line 381 of file Validate.h.

References error_on_mismatching_shapes(), and arm_compute::utils::cast::U.

383 {
384  return error_on_mismatching_shapes(function, file, line, 0U, tensor_1, tensor_2, std::forward<Ts>(tensors)...);
385 }
arm_compute::Status error_on_mismatching_shapes(const char *function, const char *file, const int line, unsigned int upper_dim, const ITensor *tensor_1, const ITensor *tensor_2, Ts... tensors)
Return an error if the passed two tensors have different shapes from the given dimension.
Definition: Validate.h:427

◆ error_on_mismatching_shapes() [3/4]

arm_compute::Status arm_compute::error_on_mismatching_shapes ( const char *  function,
const char *  file,
const int  line,
unsigned int  upper_dim,
const ITensorInfo tensor_info_1,
const ITensorInfo tensor_info_2,
Ts...  tensor_infos 
)
inline

Return an error if the passed two tensors have different shapes from the given dimension.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]upper_dimThe dimension from which to check.
[in]tensor_info_1The first tensor info to be compared.
[in]tensor_info_2The second tensor info to be compared.
[in]tensor_infos(Optional) Further allowed tensor infos.
Returns
Status

Definition at line 399 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ARM_COMPUTE_RETURN_ON_ERROR, error_on_nullptr(), arm_compute::detail::have_different_dimensions(), and tensor_info.

401 {
402  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info_1 == nullptr, function, file, line);
403  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info_2 == nullptr, function, file, line);
404  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensor_infos)...));
405 
406  const std::array < const ITensorInfo *, 2 + sizeof...(Ts) > tensors_info_array{ { tensor_info_1, tensor_info_2, std::forward<Ts>(tensor_infos)... } };
407  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(std::next(tensors_info_array.cbegin()), tensors_info_array.cend(), [&](const ITensorInfo * tensor_info)
408  {
409  return detail::have_different_dimensions((*tensors_info_array.cbegin())->tensor_shape(), tensor_info->tensor_shape(), upper_dim);
410  }),
411  function, file, line, "Tensors have different shapes");
412  return arm_compute::Status{};
413 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
Definition: Validate.h:47
TensorInfo tensor_info
Associated tensor info.

◆ error_on_mismatching_shapes() [4/4]

arm_compute::Status arm_compute::error_on_mismatching_shapes ( const char *  function,
const char *  file,
const int  line,
unsigned int  upper_dim,
const ITensor tensor_1,
const ITensor tensor_2,
Ts...  tensors 
)
inline

Return an error if the passed two tensors have different shapes from the given dimension.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]upper_dimThe dimension from which to check.
[in]tensor_1The first tensor to be compared.
[in]tensor_2The second tensor to be compared.
[in]tensors(Optional) Further allowed tensors.
Returns
Status

Definition at line 427 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_mismatching_shapes(), error_on_nullptr(), and ITensor::info().

429 {
430  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_1 == nullptr, function, file, line);
431  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_2 == nullptr, function, file, line);
432  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensors)...));
433  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_mismatching_shapes(function, file, line, upper_dim, tensor_1->info(), tensor_2->info(),
434  detail::get_tensor_info_t<ITensorInfo *>()(tensors)...));
435  return arm_compute::Status{};
436 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
arm_compute::Status error_on_mismatching_shapes(const char *function, const char *file, const int line, const ITensorInfo *tensor_info_1, const ITensorInfo *tensor_info_2, Ts... tensor_infos)
Return an error if the passed two tensor infos have different shapes from the given dimension...
Definition: Validate.h:364

◆ error_on_mismatching_windows()

arm_compute::Status error_on_mismatching_windows ( const char *  function,
const char *  file,
const int  line,
const Window full,
const Window win 
)

Return an error if the passed window is invalid.

The subwindow is invalid if:

  • It is not a valid window.
  • Its dimensions don't match the full window's ones
  • The step for each of its dimension is not identical to the corresponding one of the full window.
Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]fullFull size window
[in]winWindow to validate.
Returns
Status

Definition at line 26 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, arm_compute::mlgo::parser::end(), Dimensions< int >::num_max_dimensions, arm_compute::cpu::step, and Window::validate().

28 {
29  full.validate();
30  win.validate();
31 
32  for(size_t i = 0; i < arm_compute::Coordinates::num_max_dimensions; ++i)
33  {
34  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].start() != win[i].start(), function, file, line);
35  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].end() != win[i].end(), function, file, line);
36  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[i].step() != win[i].step(), function, file, line);
37  }
38  return arm_compute::Status{};
39 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Definition: Dimensions.h:46

◆ error_on_nullptr()

arm_compute::Status arm_compute::error_on_nullptr ( const char *  function,
const char *  file,
const int  line,
Ts &&...  pointers 
)
inline

Create an error if one of the pointers is a nullptr.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]pointersPointers to check against nullptr.
Returns
Status

Definition at line 147 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG.

Referenced by error_on_mismatching_data_layouts(), error_on_mismatching_data_types(), error_on_mismatching_shapes(), error_on_tensors_not_even(), and error_on_tensors_not_subsampled().

148 {
149  const std::array<const void *, sizeof...(Ts)> pointers_array{ { std::forward<Ts>(pointers)... } };
150  bool has_nullptr = std::any_of(pointers_array.begin(), pointers_array.end(), [&](const void *ptr)
151  {
152  return (ptr == nullptr);
153  });
154  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(has_nullptr, function, file, line, "Nullptr object!");
155  return arm_compute::Status{};
156 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
Status class.
Definition: Error.h:52

◆ error_on_tensor_not_2d() [1/2]

arm_compute::Status error_on_tensor_not_2d ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor 
)

Return an error if the tensor is not 2D.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
Returns
Status

Definition at line 92 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, ITensor::info(), and ITensorInfo::num_dimensions().

Referenced by error_on_unsupported_fp16().

94 {
95  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
96  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor->info() == nullptr, function, file, line);
97  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->info()->num_dimensions() != 2,
98  function, file, line,
99  "Only 2D Tensors are supported by this kernel (%zu passed)", tensor->info()->num_dimensions());
100  return arm_compute::Status{};
101 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_tensor_not_2d() [2/2]

arm_compute::Status error_on_tensor_not_2d ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor 
)

Return an error if the tensor info is not 2D.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor info to validate.
Returns
Status

Definition at line 103 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, and ITensorInfo::num_dimensions().

105 {
106  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
107  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(tensor->num_dimensions() != 2,
108  function, file, line,
109  "Only 2D Tensors are supported by this kernel (%zu passed)", tensor->num_dimensions());
110  return arm_compute::Status{};
111 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_tensors_not_even()

arm_compute::Status arm_compute::error_on_tensors_not_even ( const char *  function,
const char *  file,
int  line,
const Format format,
const ITensor tensor1,
Ts...  tensors 
)

Return an error if the passed tensor objects are not even.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]formatFormat to check if odd shape is allowed
[in]tensor1The first object to be compared for odd shape.
[in]tensors(Optional) Further allowed objects.
Returns
Status

Definition at line 299 of file Validate.h.

References adjust_odd_shape(), ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ARM_COMPUTE_RETURN_ON_ERROR, error_on_nullptr(), arm_compute::detail::have_different_dimensions(), and tensor.

301 {
302  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor1 == nullptr, function, file, line);
303  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensors)...));
304  const std::array < const ITensor *, 1 + sizeof...(Ts) > tensors_info_array{ { tensor1, std::forward<Ts>(tensors)... } };
305  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensors_info_array.cbegin(), tensors_info_array.cend(), [&](const ITensor * tensor)
306  {
307  const TensorShape correct_shape = adjust_odd_shape(tensor->info()->tensor_shape(), format);
308  return detail::have_different_dimensions(tensor->info()->tensor_shape(), correct_shape, 2);
309  }),
310  function, file, line, "Tensor shape has odd dimensions");
311  return arm_compute::Status{};
312 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
Definition: Validate.h:47
TensorShape adjust_odd_shape(const TensorShape &shape, Format format)
Adjust tensor shape size if width or height are odd for a given multi-planar format.
Definition: Utils.h:671
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_tensors_not_subsampled()

arm_compute::Status arm_compute::error_on_tensors_not_subsampled ( const char *  function,
const char *  file,
int  line,
const Format format,
const TensorShape shape,
const ITensor tensor1,
Ts...  tensors 
)

Return an error if the passed tensor objects are not sub-sampled.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]formatFormat to check if sub-sampling allowed.
[in]shapeThe tensor shape to calculate sub-sampling from.
[in]tensor1The first object to be compared.
[in]tensors(Optional) Further allowed objects.
Returns
Status

Definition at line 332 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ARM_COMPUTE_RETURN_ON_ERROR, calculate_subsampled_shape(), error_on_nullptr(), arm_compute::detail::have_different_dimensions(), and tensor.

334 {
335  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor1 == nullptr, function, file, line);
336  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_nullptr(function, file, line, std::forward<Ts>(tensors)...));
337  const TensorShape sub2_shape = calculate_subsampled_shape(shape, format);
338  const std::array < const ITensor *, 1 + sizeof...(Ts) > tensors_info_array{ { tensor1, std::forward<Ts>(tensors)... } };
339  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(std::any_of(tensors_info_array.cbegin(), tensors_info_array.cend(), [&](const ITensor * tensor)
340  {
341  return detail::have_different_dimensions(tensor->info()->tensor_shape(), sub2_shape, 2);
342  }),
343  function, file, line, "Tensor shape has mismatch dimensions for sub-sampling");
344  return arm_compute::Status{};
345 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
TensorShape calculate_subsampled_shape(const TensorShape &shape, Format format, Channel channel=Channel::UNKNOWN)
Calculate subsampled shape for a given format and channel.
Definition: Utils.h:698
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_nullptr(const char *function, const char *file, const int line, Ts &&... pointers)
Create an error if one of the pointers is a nullptr.
Definition: Validate.h:147
Status class.
Definition: Error.h:52
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
Definition: Validate.h:47
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_unconfigured_kernel()

arm_compute::Status error_on_unconfigured_kernel ( const char *  function,
const char *  file,
const int  line,
const IKernel kernel 
)

Return an error if the kernel is not configured.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]kernelKernel to validate.
Returns
Status

Definition at line 144 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, and IKernel::is_window_configured().

146 {
147  ARM_COMPUTE_RETURN_ERROR_ON_LOC(kernel == nullptr, function, file, line);
148  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(!kernel->is_window_configured(),
149  function, file, line,
150  "This kernel hasn't been configured.");
151  return arm_compute::Status{};
152 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52

◆ error_on_unsupported_cpu_bf16() [1/2]

Status arm_compute::error_on_unsupported_cpu_bf16 ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info 
)
inline

Return an error if the data type of the passed tensor info is BFLOAT16 and BFLOAT16 support is not compiled in.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
Returns
Status

Definition at line 64 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, BFLOAT16, ITensorInfo::data_type(), CPUInfo::get(), and CPUInfo::has_bf16().

Referenced by error_on_unsupported_cpu_bf16().

66 {
67  bool bf16_kernels_enabled = false;
68 #if defined(ARM_COMPUTE_ENABLE_BF16)
69  bf16_kernels_enabled = true;
70 #endif /* defined(ARM_COMPUTE_ENABLE_BF16) */
71 
72  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
73  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::BFLOAT16) && (!CPUInfo::get().has_bf16() || !bf16_kernels_enabled),
74  function, file, line, "This CPU architecture does not support BFloat16 data type, you need v8.6 or above");
75  return Status{};
76 }
bool has_bf16() const
Checks if the cpu model supports bf16.
Definition: CPPTypes.cpp:64
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
TensorInfo tensor_info
Associated tensor info.
static CPUInfo & get()
Access the KernelLibrary singleton.
Definition: CPPTypes.cpp:40

◆ error_on_unsupported_cpu_bf16() [2/2]

Status arm_compute::error_on_unsupported_cpu_bf16 ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor 
)
inline

Return an error if the data type of the passed tensor is BFLOAT16 and BFLOAT16 support is not compiled in.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
Returns
Status

Definition at line 104 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_unsupported_cpu_bf16(), and ITensor::info().

106 {
107  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
109  return Status{};
110 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status error_on_unsupported_cpu_bf16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info)
Return an error if the data type of the passed tensor info is BFLOAT16 and BFLOAT16 support is not co...
Definition: Validate.h:64
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_unsupported_cpu_fp16() [1/2]

Status arm_compute::error_on_unsupported_cpu_fp16 ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info 
)
inline

Return an error if the data type of the passed tensor info is FP16 and FP16 support is not compiled in.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
Returns
Status

Definition at line 41 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ITensorInfo::data_type(), F16, CPUInfo::get(), and CPUInfo::has_fp16().

Referenced by error_on_unsupported_cpu_fp16().

43 {
44  bool fp16_kernels_enabled = false;
45 #if defined(ARM_COMPUTE_ENABLE_FP16) && defined(ENABLE_FP16_KERNELS)
46  fp16_kernels_enabled = true;
47 #endif /* defined(ARM_COMPUTE_ENABLE_FP16) && defined(ENABLE_FP16_KERNELS) */
48 
49  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
50  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::F16) && (!CPUInfo::get().has_fp16() || !fp16_kernels_enabled),
51  function, file, line, "This CPU architecture does not support F16 data type, you need v8.2 or above");
52  return Status{};
53 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
bool has_fp16() const
Checks if the cpu model supports fp16.
Definition: CPPTypes.cpp:59
TensorInfo tensor_info
Associated tensor info.
static CPUInfo & get()
Access the KernelLibrary singleton.
Definition: CPPTypes.cpp:40

◆ error_on_unsupported_cpu_fp16() [2/2]

Status arm_compute::error_on_unsupported_cpu_fp16 ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor 
)
inline

Return an error if the data type of the passed tensor is FP16 and FP16 support is not compiled in.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
Returns
Status

Definition at line 87 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_unsupported_cpu_fp16(), and ITensor::info().

89 {
90  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
92  return Status{};
93 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
Status error_on_unsupported_cpu_fp16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info)
Return an error if the data type of the passed tensor info is FP16 and FP16 support is not compiled i...
Definition: Validate.h:41
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_unsupported_fp16() [1/2]

arm_compute::Status arm_compute::error_on_unsupported_fp16 ( const char *  function,
const char *  file,
const int  line,
const ITensorInfo tensor_info,
bool  is_fp16_supported 
)
inline

Return an error if the data type of the passed tensor info is FP16 and FP16 extension is not supported by the device.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensor_infoTensor info to validate.
[in]is_fp16_supportedIs fp16 supported by the device.
Returns
Status

Definition at line 801 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG, ITensorInfo::data_type(), and F16.

Referenced by error_on_unsupported_fp16().

803 {
804  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor_info == nullptr, function, file, line);
805  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG((tensor_info->data_type() == DataType::F16 && !is_fp16_supported),
806  function, file, line, "FP16 not supported by the device");
807  return arm_compute::Status{};
808 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG(cond, func, file, line, msg)
If the condition is true, an error is thrown.
Definition: Error.h:283
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
TensorInfo tensor_info
Associated tensor info.

◆ error_on_unsupported_fp16() [2/2]

arm_compute::Status arm_compute::error_on_unsupported_fp16 ( const char *  function,
const char *  file,
const int  line,
const ITensor tensor,
bool  is_fp16_supported 
)
inline

Return an error if the data type of the passed tensor is FP16 and FP16 extension is not supported by the device.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]tensorTensor to validate.
[in]is_fp16_supportedIs fp16 supported by the device.
Returns
Status

Definition at line 820 of file Validate.h.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, ARM_COMPUTE_RETURN_ON_ERROR, error_on_tensor_not_2d(), error_on_unsupported_fp16(), ITensor::info(), and tensor.

822 {
823  ARM_COMPUTE_RETURN_ERROR_ON_LOC(tensor == nullptr, function, file, line);
824  ARM_COMPUTE_RETURN_ON_ERROR(::arm_compute::error_on_unsupported_fp16(function, file, line, tensor->info(), is_fp16_supported));
825  return arm_compute::Status{};
826 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Definition: Error.h:204
arm_compute::Status error_on_unsupported_fp16(const char *function, const char *file, const int line, const ITensorInfo *tensor_info, bool is_fp16_supported)
Return an error if the data type of the passed tensor info is FP16 and FP16 extension is not supporte...
Definition: Validate.h:801
Status class.
Definition: Error.h:52
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ error_on_unsupported_int64_base_atomics()

arm_compute::Status arm_compute::error_on_unsupported_int64_base_atomics ( const char *  function,
const char *  file,
const int  line 
)
inline

Return an error if int64_base_atomics extension is not supported by the device.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
Returns
Status

Definition at line 46 of file CLValidate.h.

References ARM_COMPUTE_CREATE_ERROR_LOC, CLKernelLibrary::get(), and UNSUPPORTED_EXTENSION_USE.

47 {
48  if(!CLKernelLibrary::get().int64_base_atomics_supported())
49  {
50  return ARM_COMPUTE_CREATE_ERROR_LOC(arm_compute::ErrorCode::UNSUPPORTED_EXTENSION_USE, function, file, line, "Atomic functions are not supported");
51  }
52  return arm_compute::Status{};
53 }
Status class.
Definition: Error.h:52
#define ARM_COMPUTE_CREATE_ERROR_LOC(error_code, func, file, line, msg)
Creates an error on location with a given message.
Definition: Error.h:169

◆ error_on_window_dimensions_gte()

arm_compute::Status error_on_window_dimensions_gte ( const char *  function,
const char *  file,
const int  line,
const Window win,
unsigned int  max_dim 
)

Return an error if the passed window has too many dimensions.

The window has too many dimensions if any of the dimension greater or equal to max_dim is different from 0.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]winWindow to validate
[in]max_dimMaximum number of dimensions allowed.
Returns
Status

Definition at line 80 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR, arm_compute::mlgo::parser::end(), Dimensions< int >::num_max_dimensions, and arm_compute::cpu::step.

82 {
83  for(unsigned int i = max_dim; i < arm_compute::Coordinates::num_max_dimensions; ++i)
84  {
85  ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR((win[i].start() != 0) || (win[i].end() != win[i].step()),
86  function, file, line,
87  "Maximum number of dimensions expected %u but dimension %u is not empty", max_dim, i);
88  }
89  return arm_compute::Status{};
90 }
Status class.
Definition: Error.h:52
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC_MSG_VAR(cond, func, file, line, msg,...)
If the condition is true, an error is thrown.
Definition: Error.h:263
constexpr int step
Definition: fp32.cpp:35
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
Definition: Dimensions.h:46

◆ error_on_window_not_collapsable_at_dimension()

arm_compute::Status error_on_window_not_collapsable_at_dimension ( const char *  function,
const char *  file,
const int  line,
const Window full,
const Window window,
const int  dim 
)

Return an error if the window can't be collapsed at the given dimension.

The window cannot be collapsed if the given dimension not equal to the full window's dimension or not start from 0.

Parameters
[in]functionFunction in which the error occurred.
[in]fileName of the file where the error occurred.
[in]lineLine on which the error occurred.
[in]fullFull size window
[in]windowWindow to be collapsed.
[in]dimDimension need to be checked.
Returns
Status

Definition at line 57 of file Validate.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON_LOC, arm_compute::mlgo::parser::end(), and Window::validate().

59 {
60  full.validate();
61  window.validate();
62 
63  ARM_COMPUTE_RETURN_ERROR_ON_LOC(window[dim].start() != 0, function, file, line);
64  ARM_COMPUTE_RETURN_ERROR_ON_LOC(window[dim].start() != full[dim].start(), function, file, line);
65  ARM_COMPUTE_RETURN_ERROR_ON_LOC(full[dim].end() != window[dim].end(), function, file, line);
66 
67  return arm_compute::Status{};
68 }
#define ARM_COMPUTE_RETURN_ERROR_ON_LOC(cond, func, file, line)
If the condition is true, an error is returned.
Definition: Error.h:306
Status class.
Definition: Error.h:52
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

◆ execute_window_loop()

void execute_window_loop ( const Window w,
L &&  lambda_function,
Ts &&...  iterators 
)
inline

Iterate through the passed window, automatically adjusting the iterators and calling the lambda_functino for each element.

It passes the x and y positions to the lambda_function for each iteration

Parameters
[in]wWindow to iterate through.
[in]lambda_functionThe function of type void(function)( const Coordinates & id ) to call at each iteration. Where id represents the absolute coordinates of the item to process.
[in,out]iteratorsTensor iterators which will be updated by this function before calling lambda_function.

Definition at line 77 of file Helpers.inl.

References ARM_COMPUTE_ERROR_ON, Dimensions< int >::num_max_dimensions, arm_compute::cpu::step, and Window::validate().

Referenced by arm_compute::cpu::add_q8_neon_fixedpoint(), arm_compute::cpu::add_qasymm8_neon(), arm_compute::cpu::add_qasymm8_signed_neon(), arm_compute::cpu::add_qasymm8_signed_sve2(), arm_compute::cpu::add_qasymm8_sve2(), arm_compute::cpu::add_qsymm16_neon(), arm_compute::cpu::add_qsymm16_sve2(), arm_compute::cpu::add_same_neon(), arm_compute::cpu::add_same_sve(), arm_compute::cpu::avg_poolingMxNxD_q8_neon_ndhwc(), arm_compute::cpu::bounding_box_transform(), arm_compute::cpu::bounding_box_transform_qsymm16(), colorconvert_iyuv_to_nv12(), colorconvert_iyuv_to_rgb(), colorconvert_iyuv_to_yuv4(), colorconvert_nv12_to_iyuv(), colorconvert_nv12_to_rgb(), colorconvert_nv12_to_yuv4(), colorconvert_rgb_to_iyuv(), colorconvert_rgb_to_nv12(), colorconvert_rgb_to_rgbx(), colorconvert_rgb_to_u8(), colorconvert_rgb_to_yuv4(), colorconvert_rgbx_to_rgb(), colorconvert_yuyv_to_iyuv(), colorconvert_yuyv_to_nv12(), colorconvert_yuyv_to_rgb(), arm_compute::utils::compare_tensor(), arm_compute::cpu::compute_all_anchors(), arm_compute::cpu::compute_all_anchors_qasymm16(), CpuScaleKernel::configure(), NENormalizationLayerKernel::configure(), arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), ITensor::copy_from(), arm_compute::cpu::directconv3d_float_neon_ndhwc(), arm_compute::cpu::directconv3d_quantized_neon_ndhwc(), arm_compute::cpu::elementwise_arithmetic_op(), arm_compute::cpu::elementwise_arithmetic_quantized_op(), arm_compute::cpu::elementwise_comp_quantized_signed(), arm_compute::cpu::elementwise_comparison_op(), arm_compute::cpu::elementwise_comparison_quantized_op(), arm_compute::cpu::elementwise_op(), arm_compute::cpu::elementwise_op_quantized(), arm_compute::cpu::elementwise_op_quantized_signed(), arm_compute::cpu::elementwise_sve_op(), AssetsLibrary::fill_borders_with_garbage(), AssetsLibrary::fill_layer_data(), arm_compute::utils::fill_random_tensor(), NPYLoader::fill_tensor(), arm_compute::utils::fill_tensor_value(), arm_compute::utils::fill_tensor_vector(), arm_compute::cpu::fp_neon_activation_impl(), arm_compute::cpu::fused_batch_normalization_conv(), arm_compute::cpu::fused_batch_normalization_dwc_nchw(), arm_compute::cpu::fused_batch_normalization_dwc_nhwc(), arm_compute::test::validation::reference::gather(), arm_compute::cpu::instance_normalization_nchw(), arm_compute::cpu::l2_normalize_x(), arm_compute::cpu::l2_normalize_yz(), arm_compute::utils::load_trained_data(), arm_compute::cpu::matrix_addition_f32(), arm_compute::cpu::matrix_matrix_multiply_f32(), arm_compute::cpu::max_poolingMxNxD_q8_neon_ndhwc(), arm_compute::cpu::max_unpooling(), arm_compute::cpu::mean_stddev_normalization(), NEGatherKernel::NEGatherKernel(), arm_compute::cpu::neon_logits_1d_max(), arm_compute::cpu::neon_qasymm8_activation(), arm_compute::cpu::neon_qasymm8_meanstddevnorm(), arm_compute::cpu::neon_qasymm8_signed_activation(), arm_compute::cpu::neon_qsymm16_activation(), arm_compute::cpu::neon_range_function(), arm_compute::cpu::neon_softmax_logits_1d_float(), arm_compute::cpu::neon_softmax_logits_1d_quantized(), arm_compute::cpu::poolingMxN_fp32_neon_nhwc(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), CaffePreproccessor::preprocess(), TFPreproccessor::preprocess(), RandomAccessor::RandomAccessor(), NEBitwiseNotKernel::run(), CPPUpsampleKernel::run(), NEBitwiseOrKernel::run(), NEBitwiseAndKernel::run(), NEBitwiseXorKernel::run(), NETileKernel::run(), NEDepthToSpaceLayerKernel::run(), NESpaceToDepthLayerKernel::run(), NEFFTScaleKernel::run(), NEQLSTMLayerNormalizationKernel::run(), NEReorgLayerKernel::run(), NEFFTRadixStageKernel::run(), NEStackLayerKernel::run(), NEBatchToSpaceLayerKernel::run(), NESpaceToBatchLayerKernel::run(), CpuFillKernel::run_op(), CpuConvertQuantizedSignednessKernel::run_op(), CpuCopyKernel::run_op(), CpuConcatenateWidthKernel::run_op(), CpuConcatenateHeightKernel::run_op(), CpuConvertFullyConnectedWeightsKernel::run_op(), CpuFloorKernel::run_op(), CpuGemmInterleave4x4Kernel::run_op(), CpuCastKernel::run_op(), CpuCol2ImKernel::run_op(), NEFillBorderKernel::run_op(), CpuWeightsReshapeKernel::run_op(), CpuGemmTranspose1xWKernel::run_op(), run_reverse(), arm_compute::utils::save_to_npy(), arm_compute::utils::save_to_ppm(), arm_compute::cpu::select_op(), arm_compute::test::validation::reference::slice(), arm_compute::test::validation::reference::softmax_layer_generic(), arm_compute::test::validation::reference::strided_slice(), arm_compute::cpu::sub_qasymm8_neon(), arm_compute::cpu::sub_qasymm8_signed_neon(), arm_compute::cpu::sub_qsymm16_neon(), arm_compute::cpu::sub_same_neon(), arm_compute::cpu::sve2_qasymm8_activation(), arm_compute::cpu::sve2_qasymm8_signed_activation(), arm_compute::cpu::sve2_qsymm16_activation(), arm_compute::cpu::sve2_softmax_logits_1d_quantized(), arm_compute::cpu::sve_fp32_activation(), arm_compute::cpu::sve_logits_1d_max(), arm_compute::cpu::sve_softmax_logits_1d_float(), arm_compute::test::validation::TEST_CASE(), CpuQuantizeKernel::validate(), CpuGemmLowpMatrixAReductionKernel::validate(), NEFFTDigitReverseKernel::validate(), CpuGemmLowpMatrixBReductionKernel::validate(), and arm_compute::cpu::vector_matrix_multiply_f32().

78 {
79  w.validate();
80 
81  for(unsigned int i = 0; i < Coordinates::num_max_dimensions; ++i)
82  {
83  ARM_COMPUTE_ERROR_ON(w[i].step() == 0);
84  }
85 
86  Coordinates id;
87  ForEachDimension<Coordinates::num_max_dimensions>::unroll(w, id, std::forward<L>(lambda_function), std::forward<Ts>(iterators)...);
88 }
SimpleTensor< float > w
Definition: DFT.cpp:156
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
constexpr int step
Definition: fp32.cpp:35

◆ export_to_cl_image()

bool export_to_cl_image ( const ITensorInfo tensor)

Definition at line 444 of file CLHelpers.cpp.

References ITensorInfo::data_type(), CLKernelLibrary::get(), get_cl_image_pitch_alignment(), CLKernelLibrary::get_device(), image2d_from_buffer_supported(), is_data_type_float(), and ITensorInfo::tensor_shape().

Referenced by ClDirectConvolutionKernelComponent::allocate_shared_vars(), ClDirectConvDefaultConfigValhall::configure(), ClDirectConvDefaultConfigBifrost::configure(), arm_compute::test::validation::DATA_TEST_CASE(), and ClDirectConvolutionKernelComponent::generate_build_options().

445 {
446  if(tensor->tensor_shape()[0] % 4)
447  {
448  return false;
449  }
450 
451  // If not floating point
452  if(!is_data_type_float(tensor->data_type()))
453  {
454  return false;
455  }
456 
457  // Check if the cl_khr_image2d_from_buffer extension is supported on the target platform
458  if(!image2d_from_buffer_supported(CLKernelLibrary::get().get_device()))
459  {
460  return false;
461  }
462 
463  // Check cl image pitch alignment
464  if(get_cl_image_pitch_alignment(CLKernelLibrary::get().get_device()) == 0)
465  {
466  return false;
467  }
468 
469  const size_t image_w = tensor->tensor_shape()[0] / 4;
470  const size_t image_h = tensor->tensor_shape()[1] * tensor->tensor_shape()[2] * tensor->tensor_shape()[3];
471  const size_t max_image_w = CLKernelLibrary::get().get_device().getInfo<CL_DEVICE_IMAGE2D_MAX_WIDTH>();
472  const size_t max_image_h = CLKernelLibrary::get().get_device().getInfo<CL_DEVICE_IMAGE2D_MAX_HEIGHT>();
473 
474  if(image_w > max_image_w || image_h > max_image_h)
475  {
476  return false;
477  }
478 
479  return true;
480 }
bool image2d_from_buffer_supported(const cl::Device &device)
Helper function to check whether the cl_khr_image2d_from_buffer extension is supported.
Definition: CLHelpers.cpp:374
size_t get_cl_image_pitch_alignment(const cl::Device &device)
Helper function to get the cl_image pitch alignment in pixels.
Definition: CLHelpers.cpp:379
CLTensor * tensor
Pointer to the auxiliary tensor.
bool is_data_type_float(DataType dt)
Check if a given data type is of floating point type.
Definition: Utils.h:1010

◆ finalize_quantization() [1/4]

uint8x16_t arm_compute::finalize_quantization ( int32x4x4_t &  in_s32,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int32x4_t  result_offset_after_shift_s32,
uint8x16_t  min_u8,
uint8x16_t  max_u8,
bool  is_bounded_relu 
)
inline

Performs final quantization step on 16 elements.

Parameters
[in]in_s32Input to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]result_offset_after_shift_s32Result offset parameter
[in]min_u8Relu lower bound
[in]max_u8Relu upper bound
[in]is_bounded_reluSpecified if a fused bounded relu should be applied
Returns
Quantized values

Definition at line 81 of file NEAsymm.h.

References rounding_divide_by_pow2().

Referenced by arm_compute::cpu::directconv3d_quantized_neon_ndhwc().

88 {
89  const static int32x4_t zero_s32 = vdupq_n_s32(0);
90 
91  if(result_shift < 0)
92  {
93  in_s32.val[0] = vmulq_n_s32(in_s32.val[0], (1 << (-result_shift)));
94  in_s32.val[1] = vmulq_n_s32(in_s32.val[1], (1 << (-result_shift)));
95  in_s32.val[2] = vmulq_n_s32(in_s32.val[2], (1 << (-result_shift)));
96  in_s32.val[3] = vmulq_n_s32(in_s32.val[3], (1 << (-result_shift)));
97 
98  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
99  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
100  in_s32.val[2] = vqrdmulhq_n_s32(in_s32.val[2], result_fixedpoint_multiplier);
101  in_s32.val[3] = vqrdmulhq_n_s32(in_s32.val[3], result_fixedpoint_multiplier);
102  }
103  else
104  {
105  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
106  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
107  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
108  in_s32.val[2] = vqrdmulhq_n_s32(in_s32.val[2], result_fixedpoint_multiplier);
109  in_s32.val[3] = vqrdmulhq_n_s32(in_s32.val[3], result_fixedpoint_multiplier);
110 
111  // Round to the nearest division by a power-of-two using result_shift_s32
112  in_s32.val[0] = rounding_divide_by_pow2(in_s32.val[0], result_shift);
113  in_s32.val[1] = rounding_divide_by_pow2(in_s32.val[1], result_shift);
114  in_s32.val[2] = rounding_divide_by_pow2(in_s32.val[2], result_shift);
115  in_s32.val[3] = rounding_divide_by_pow2(in_s32.val[3], result_shift);
116  }
117 
118  // Add the offset terms
119  in_s32.val[0] = vaddq_s32(in_s32.val[0], result_offset_after_shift_s32);
120  in_s32.val[1] = vaddq_s32(in_s32.val[1], result_offset_after_shift_s32);
121  in_s32.val[2] = vaddq_s32(in_s32.val[2], result_offset_after_shift_s32);
122  in_s32.val[3] = vaddq_s32(in_s32.val[3], result_offset_after_shift_s32);
123 
124  // Saturate negative values
125  in_s32.val[0] = vmaxq_s32(in_s32.val[0], zero_s32);
126  in_s32.val[1] = vmaxq_s32(in_s32.val[1], zero_s32);
127  in_s32.val[2] = vmaxq_s32(in_s32.val[2], zero_s32);
128  in_s32.val[3] = vmaxq_s32(in_s32.val[3], zero_s32);
129 
130  // Convert S32 to S16
131  const int16x8x2_t in_s16 =
132  {
133  {
134  vcombine_s16(vqmovn_s32(in_s32.val[0]), vqmovn_s32(in_s32.val[1])),
135  vcombine_s16(vqmovn_s32(in_s32.val[2]), vqmovn_s32(in_s32.val[3]))
136  }
137  };
138 
139  // Convert S16 to U8
140  uint8x16_t out_u8 = vcombine_u8(vqmovun_s16(in_s16.val[0]), vqmovun_s16(in_s16.val[1]));
141 
142  if(is_bounded_relu)
143  {
144  out_u8 = vmaxq_u8(out_u8, min_u8);
145  out_u8 = vminq_u8(out_u8, max_u8);
146  }
147 
148  return out_u8;
149 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization() [2/4]

int8x16_t arm_compute::finalize_quantization ( int32x4x4_t &  in_s32,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int32x4_t  result_offset_after_shift_s32,
int8x16_t  min_s8,
int8x16_t  max_s8,
bool  is_bounded_relu 
)
inline

Performs final quantization step on 16 elements.

Parameters
[in]in_s32Input to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]result_offset_after_shift_s32Result offset parameter
[in]min_s8Relu lower bound
[in]max_s8Relu upper bound
[in]is_bounded_reluSpecified if a fused bounded relu should be applied
Returns
Quantized values

Definition at line 163 of file NEAsymm.h.

References rounding_divide_by_pow2().

170 {
171  if(result_shift < 0)
172  {
173  in_s32.val[0] = vmulq_n_s32(in_s32.val[0], (1 << (-result_shift)));
174  in_s32.val[1] = vmulq_n_s32(in_s32.val[1], (1 << (-result_shift)));
175  in_s32.val[2] = vmulq_n_s32(in_s32.val[2], (1 << (-result_shift)));
176  in_s32.val[3] = vmulq_n_s32(in_s32.val[3], (1 << (-result_shift)));
177 
178  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
179  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
180  in_s32.val[2] = vqrdmulhq_n_s32(in_s32.val[2], result_fixedpoint_multiplier);
181  in_s32.val[3] = vqrdmulhq_n_s32(in_s32.val[3], result_fixedpoint_multiplier);
182  }
183  else
184  {
185  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
186  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
187  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
188  in_s32.val[2] = vqrdmulhq_n_s32(in_s32.val[2], result_fixedpoint_multiplier);
189  in_s32.val[3] = vqrdmulhq_n_s32(in_s32.val[3], result_fixedpoint_multiplier);
190 
191  // Round to the nearest division by a power-of-two using result_shift_s32
192  in_s32.val[0] = rounding_divide_by_pow2(in_s32.val[0], result_shift);
193  in_s32.val[1] = rounding_divide_by_pow2(in_s32.val[1], result_shift);
194  in_s32.val[2] = rounding_divide_by_pow2(in_s32.val[2], result_shift);
195  in_s32.val[3] = rounding_divide_by_pow2(in_s32.val[3], result_shift);
196  }
197 
198  // Add the offset terms
199  in_s32.val[0] = vaddq_s32(in_s32.val[0], result_offset_after_shift_s32);
200  in_s32.val[1] = vaddq_s32(in_s32.val[1], result_offset_after_shift_s32);
201  in_s32.val[2] = vaddq_s32(in_s32.val[2], result_offset_after_shift_s32);
202  in_s32.val[3] = vaddq_s32(in_s32.val[3], result_offset_after_shift_s32);
203 
204  // Convert S32 to S16
205  const int16x8x2_t in_s16 =
206  {
207  {
208  vcombine_s16(vqmovn_s32(in_s32.val[0]), vqmovn_s32(in_s32.val[1])),
209  vcombine_s16(vqmovn_s32(in_s32.val[2]), vqmovn_s32(in_s32.val[3]))
210  }
211  };
212 
213  // Convert S16 to S8
214  int8x16_t out_s8 = vcombine_s8(vqmovn_s16(in_s16.val[0]), vqmovn_s16(in_s16.val[1]));
215 
216  if(is_bounded_relu)
217  {
218  out_s8 = vmaxq_s8(out_s8, min_s8);
219  out_s8 = vminq_s8(out_s8, max_s8);
220  }
221 
222  return out_s8;
223 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization() [3/4]

uint8_t arm_compute::finalize_quantization ( int32_t  in_value,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int32_t  result_offset_after_shift_s32,
uint8_t  min_u8,
uint8_t  max_u8,
bool  is_bounded_relu 
)
inline

Performs final quantization step on single element.

Parameters
[in]in_valueInput to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]result_offset_after_shift_s32Result offset parameter
[in]min_u8Relu lower bound
[in]max_u8Relu upper bound
[in]is_bounded_reluSpecified if a fused bounded relu should be applied
Returns
Quantized value

Definition at line 333 of file NEAsymm.h.

References rounding_divide_by_pow2().

336 {
337  int32x4_t in_s32 = vdupq_n_s32(in_value);
338 
339  if(result_shift < 0)
340  {
341  in_value = vgetq_lane_s32(vqrdmulhq_n_s32(vmulq_n_s32(in_s32, (1 << (-result_shift))), result_fixedpoint_multiplier), 0);
342  }
343  else
344  {
345  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
346  in_value = vgetq_lane_s32(vqrdmulhq_n_s32(in_s32, result_fixedpoint_multiplier), 0);
347  // Shift value by result_shift_s32
348  in_value = rounding_divide_by_pow2(in_value, result_shift);
349  }
350 
351  // Add the offset term
352  in_value += result_offset_after_shift_s32;
353 
354  // Bound the result
355  uint8_t out_u8 = static_cast<uint8_t>(std::max<int32_t>(0, std::min<int32_t>(255, in_value)));
356  if(is_bounded_relu)
357  {
358  out_u8 = static_cast<uint8_t>(std::max(min_u8, std::min(max_u8, out_u8)));
359  }
360 
361  return out_u8;
362 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization() [4/4]

int8_t arm_compute::finalize_quantization ( int32_t  in_value,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int32_t  result_offset_after_shift_s32,
int8_t  min_s8,
int8_t  max_s8,
bool  is_bounded_relu 
)
inline

Performs final quantization step on single element.

Parameters
[in]in_valueInput to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]result_offset_after_shift_s32Result offset parameter
[in]min_s8Relu lower bound
[in]max_s8Relu upper bound
[in]is_bounded_reluSpecified if a fused bounded relu should be applied
Returns
Quantized value

Definition at line 376 of file NEAsymm.h.

References rounding_divide_by_pow2().

379 {
380  int32x4_t in_s32 = vdupq_n_s32(in_value);
381 
382  if(result_shift < 0)
383  {
384  in_value = vgetq_lane_s32(vqrdmulhq_n_s32(vmulq_n_s32(in_s32, (1 << (-result_shift))), result_fixedpoint_multiplier), 0);
385  }
386  else
387  {
388  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
389  in_value = vgetq_lane_s32(vqrdmulhq_n_s32(in_s32, result_fixedpoint_multiplier), 0);
390 
391  // Shift value by result_shift_s32
392  in_value = rounding_divide_by_pow2(in_value, result_shift);
393  }
394 
395  // Add the offset term
396  in_value += result_offset_after_shift_s32;
397 
398  // Bound the result
399  int8_t out_s8 = static_cast<int8_t>(std::max<int32_t>(-128, std::min<int32_t>(127, in_value)));
400  if(is_bounded_relu)
401  {
402  out_s8 = static_cast<int8_t>(std::max(min_s8, std::min(max_s8, out_s8)));
403  }
404 
405  return out_s8;
406 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization_int16() [1/2]

int16x8_t arm_compute::finalize_quantization_int16 ( int32x4x2_t &  in_s32,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int16x8_t  min_s16,
int16x8_t  max_s16 
)

Performs final quantization step on 8 signed 16-bit elements.

Template Parameters
is_bounded_reluSpecified if a fused bounded relu should be applied
Parameters
[in]in_s32Input to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]min_s16Relu lower bound
[in]max_s16Relu upper bound
Returns
Quantized values

Definition at line 52 of file NESymm.h.

References rounding_divide_by_pow2().

57 {
58  if(result_shift < 0)
59  {
60  in_s32.val[0] = vmulq_n_s32(in_s32.val[0], (1 << -result_shift));
61  in_s32.val[1] = vmulq_n_s32(in_s32.val[1], (1 << -result_shift));
62 
63  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
64  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
65  }
66  else
67  {
68  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
69  in_s32.val[0] = vqrdmulhq_n_s32(in_s32.val[0], result_fixedpoint_multiplier);
70  in_s32.val[1] = vqrdmulhq_n_s32(in_s32.val[1], result_fixedpoint_multiplier);
71  // Round to the nearest division by a power-of-two using result_shift_s32
72  in_s32.val[0] = rounding_divide_by_pow2(in_s32.val[0], result_shift);
73  in_s32.val[1] = rounding_divide_by_pow2(in_s32.val[1], result_shift);
74  }
75 
76  // Convert S32 to S16
77  int16x8_t out_s16 = vcombine_s16(vqmovn_s32(in_s32.val[0]), vqmovn_s32(in_s32.val[1]));
78 
79  if(is_bounded_relu)
80  {
81  out_s16 = vmaxq_s16(out_s16, min_s16);
82  out_s16 = vminq_s16(out_s16, max_s16);
83  }
84 
85  return out_s16;
86 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization_int16() [2/2]

int16_t arm_compute::finalize_quantization_int16 ( int32_t  in_value,
int  result_fixedpoint_multiplier,
int32_t  result_shift,
int16_t  min_s16,
int16_t  max_s16 
)
inline

Performs final quantization step on single signed 16-bit element.

Template Parameters
is_bounded_reluSpecified if a fused bounded relu should be applied
Parameters
[in]in_valueInput to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]min_s16Relu lower bound
[in]max_s16Relu upper bound
Returns
Quantized values

Definition at line 101 of file NESymm.h.

References rounding_divide_by_pow2().

103 {
104  if(result_shift < 0)
105  {
106  const int64_t in_64 = static_cast<int64_t>(in_value) * (1 << (-result_shift)) * static_cast<int64_t>(result_fixedpoint_multiplier);
107  in_value = static_cast<int32_t>((in_64 + (1 << 30)) >> 31);
108  }
109  else
110  {
111  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
112  const int64_t in_64 = static_cast<int64_t>(in_value) * static_cast<int64_t>(result_fixedpoint_multiplier);
113  // Shift value by result_shift_s32
114  in_value = rounding_divide_by_pow2(static_cast<int32_t>((in_64 + (1 << 30)) >> 31), result_shift);
115  }
116 
117  // Bound the result
118  int16_t out_s16 = static_cast<int16_t>(std::max<int32_t>(-32768, std::min<int32_t>(32767, in_value)));
119 
120  if(is_bounded_relu)
121  {
122  out_s16 = static_cast<int16_t>(std::max(min_s16, std::min(max_s16, out_s16)));
123  }
124 
125  return out_s16;
126 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ finalize_quantization_symm()

int8x16_t arm_compute::finalize_quantization_symm ( int32x4x4_t &  in_s32,
const int32x4x4_t &  result_fixedpoint_multiplier,
const int32x4x4_t &  result_shift,
const int32x4_t &  result_offset_after_shift_s32,
const int8x16_t &  min_s8,
const int8x16_t &  max_s8,
const bool  is_bounded_relu 
)
inline

Performs final quantization step on 16 elements for symmetric quantization.

Parameters
[in]in_s32Input to be quantized.
[in]result_fixedpoint_multiplierResult multiplier parameter
[in]result_shiftResult shift parameter
[in]result_offset_after_shift_s32Result offset parameter
[in]min_s8Relu lower bound
[in]max_s8Relu upper bound
[in]is_bounded_reluSpecified if a fused bounded relu should be applied
Returns
Quantized values

Definition at line 237 of file NEAsymm.h.

References rounding_divide_by_pow2().

244 {
245  const static int32x4_t one_s32 = vdupq_n_s32(1);
246 
247  // Fixed point multiplication with vector saturating rounding doubling multiply high with scalar
248  int32x4x4_t res_shift_gt0 =
249  {
250  vqrdmulhq_s32(in_s32.val[0], result_fixedpoint_multiplier.val[0]),
251  vqrdmulhq_s32(in_s32.val[1], result_fixedpoint_multiplier.val[1]),
252  vqrdmulhq_s32(in_s32.val[2], result_fixedpoint_multiplier.val[2]),
253  vqrdmulhq_s32(in_s32.val[3], result_fixedpoint_multiplier.val[3]),
254  };
255  // Round to the nearest division by a power-of-two using result_shift_s32
256  res_shift_gt0.val[0] = rounding_divide_by_pow2(res_shift_gt0.val[0], result_shift.val[0]);
257  res_shift_gt0.val[1] = rounding_divide_by_pow2(res_shift_gt0.val[1], result_shift.val[1]);
258  res_shift_gt0.val[2] = rounding_divide_by_pow2(res_shift_gt0.val[2], result_shift.val[2]);
259  res_shift_gt0.val[3] = rounding_divide_by_pow2(res_shift_gt0.val[3], result_shift.val[3]);
260 
261  int32x4x4_t res_shift_lt0 =
262  {
263  vmulq_s32(in_s32.val[0], vshlq_s32(one_s32, vnegq_s32(result_shift.val[0]))),
264  vmulq_s32(in_s32.val[1], vshlq_s32(one_s32, vnegq_s32(result_shift.val[1]))),
265  vmulq_s32(in_s32.val[2], vshlq_s32(one_s32, vnegq_s32(result_shift.val[2]))),
266  vmulq_s32(in_s32.val[3], vshlq_s32(one_s32, vnegq_s32(result_shift.val[3]))),
267  };
268  res_shift_lt0.val[0] = vqrdmulhq_s32(res_shift_lt0.val[0], result_fixedpoint_multiplier.val[0]);
269  res_shift_lt0.val[1] = vqrdmulhq_s32(res_shift_lt0.val[1], result_fixedpoint_multiplier.val[1]);
270  res_shift_lt0.val[2] = vqrdmulhq_s32(res_shift_lt0.val[2], result_fixedpoint_multiplier.val[2]);
271  res_shift_lt0.val[3] = vqrdmulhq_s32(res_shift_lt0.val[3], result_fixedpoint_multiplier.val[3]);
272 
273  // Select result depending on shift value
274  const uint32x4x4_t mask_lt0 =
275  {
276 #ifdef __aarch64__
277  vcltzq_s32(result_shift.val[0]),
278  vcltzq_s32(result_shift.val[1]),
279  vcltzq_s32(result_shift.val[2]),
280  vcltzq_s32(result_shift.val[3]),
281 #else //__aarch64__
282  vcltq_s32(result_shift.val[0], vdupq_n_s32(0)),
283  vcltq_s32(result_shift.val[1], vdupq_n_s32(0)),
284  vcltq_s32(result_shift.val[2], vdupq_n_s32(0)),
285  vcltq_s32(result_shift.val[3], vdupq_n_s32(0)),
286 #endif //__aarch64__
287  };
288 
289  in_s32.val[0] = vbslq_s32(mask_lt0.val[0], res_shift_lt0.val[0], res_shift_gt0.val[0]);
290  in_s32.val[1] = vbslq_s32(mask_lt0.val[1], res_shift_lt0.val[1], res_shift_gt0.val[1]);
291  in_s32.val[2] = vbslq_s32(mask_lt0.val[2], res_shift_lt0.val[2], res_shift_gt0.val[2]);
292  in_s32.val[3] = vbslq_s32(mask_lt0.val[3], res_shift_lt0.val[3], res_shift_gt0.val[3]);
293 
294  // Add the offset terms
295  in_s32.val[0] = vaddq_s32(in_s32.val[0], result_offset_after_shift_s32);
296  in_s32.val[1] = vaddq_s32(in_s32.val[1], result_offset_after_shift_s32);
297  in_s32.val[2] = vaddq_s32(in_s32.val[2], result_offset_after_shift_s32);
298  in_s32.val[3] = vaddq_s32(in_s32.val[3], result_offset_after_shift_s32);
299 
300  // Convert S32 to S16
301  const int16x8x2_t in_s16 =
302  {
303  {
304  vcombine_s16(vqmovn_s32(in_s32.val[0]), vqmovn_s32(in_s32.val[1])),
305  vcombine_s16(vqmovn_s32(in_s32.val[2]), vqmovn_s32(in_s32.val[3]))
306  }
307  };
308 
309  // Convert S16 to S8
310  int8x16_t out_s8 = vcombine_s8(vqmovn_s16(in_s16.val[0]), vqmovn_s16(in_s16.val[1]));
311 
312  if(is_bounded_relu)
313  {
314  out_s8 = vmaxq_s8(out_s8, min_s8);
315  out_s8 = vminq_s8(out_s8, max_s8);
316  }
317 
318  return out_s8;
319 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ float_to_string_with_full_precision()

std::string arm_compute::float_to_string_with_full_precision ( float  val)
inline

Create a string with the float in full precision.

Parameters
valFloating point value
Returns
String with the floating point value.

Definition at line 1124 of file Utils.h.

References arm_compute::test::validation::ss().

Referenced by ClElementwiseKernel::ClElementwiseKernel(), ClDequantizeKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClQuantizeKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), ClDepthConcatenateKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), ClWinogradOutputTransformKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLComputeAllAnchorsKernel::configure(), CLNormalizationLayerKernel::configure(), CLComparisonKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClDirectConv2dKernel::configure(), CLRangeKernel::configure(), CLReductionOperationKernel::configure(), ClMulKernel::configure(), CLBoundingBoxTransformKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLROIPoolingLayerKernel::configure(), CLROIAlignLayerKernel::configure(), CLBatchNormalizationLayerKernel::configure(), CLFuseBatchNormalizationKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClComplexMulKernel::configure(), ClLogits1DNormKernel::configure(), PostOpCLKernelUtils::set_post_ops_cl_build_options(), and string_from_pixel_value().

1125 {
1126  std::stringstream ss;
1127  ss.precision(std::numeric_limits<float>::max_digits10);
1128  ss << val;
1129 
1130  if(val != static_cast<int>(val))
1131  {
1132  ss << "f";
1133  }
1134 
1135  return ss.str();
1136 }
std::stringstream ss(mlgo_str)

◆ floor_to_multiple()

auto arm_compute::floor_to_multiple ( value,
divisor 
) -> decltype((value / divisor) * divisor)
inline

Computes the largest number smaller or equal to value that is a multiple of divisor.

Parameters
[in]valueUpper bound value
[in]divisorValue to compute multiple of.
Returns
the result.

Definition at line 85 of file Utils.h.

References ARM_COMPUTE_ERROR_ON, and read_file().

86 {
87  ARM_COMPUTE_ERROR_ON(value < 0 || divisor <= 0);
88  return (value / divisor) * divisor;
89 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466

◆ fp16_supported()

bool fp16_supported ( const cl::Device &  device)

Helper function to check whether the cl_khr_fp16 extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 236 of file CLHelpers.cpp.

References device_supports_extension().

237 {
238  return device_supports_extension(device, "cl_khr_fp16");
239 }
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283

◆ get_arch_from_target()

GPUTarget get_arch_from_target ( GPUTarget  target)

◆ get_cl_dot8_acc_type_from_data_type()

std::string get_cl_dot8_acc_type_from_data_type ( const DataType dt)

Translates a tensor data type to the appropriate OpenCL dot8 accumulator type.

Parameters
[in]dtDataType to be translated to OpenCL dot8 accumulator type.
Returns
The string specifying the OpenCL dot8 accumulator type to be used.

Definition at line 175 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, QASYMM8, QASYMM8_SIGNED, QSYMM8, QSYMM8_PER_CHANNEL, S8, and U8.

Referenced by ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), and ClGemmLowpMatrixBReductionKernel::configure().

176 {
177  switch(dt)
178  {
179  case DataType::U8:
180  case DataType::QASYMM8:
181  return "uint";
182  case DataType::S8:
183  case DataType::QASYMM8_SIGNED:
184  case DataType::QSYMM8:
185  case DataType::QSYMM8_PER_CHANNEL:
186  return "int";
187  default:
188  ARM_COMPUTE_ERROR("Unsupported data type.");
189  return "";
190  }
191 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_image_pitch_alignment()

size_t get_cl_image_pitch_alignment ( const cl::Device &  device)

Helper function to get the cl_image pitch alignment in pixels.

Parameters
[in]deviceA CL device
Returns
the cl_image pitch alignment in pixels. If an error occurs, the function will return 0

Definition at line 379 of file CLHelpers.cpp.

References clGetDeviceInfo().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), export_to_cl_image(), arm_compute::experimental::dynamic_fusion::export_to_cl_image_support(), examples::gemm_tuner_helpers::update_padding_for_cl_image(), arm_compute::opencl::kernels::gemm::update_padding_for_cl_image(), and arm_compute::opencl::kernels::gemm::validate_image2d_support_on_rhs().

380 {
381  cl_uint pixel_aligment = 0;
382 
383  cl_int err = clGetDeviceInfo(device(), CL_DEVICE_IMAGE_PITCH_ALIGNMENT, sizeof(cl_uint), &pixel_aligment, nullptr);
384 
385  if(err == CL_SUCCESS)
386  {
387  return pixel_aligment;
388  }
389  else
390  {
391  return 0;
392  }
393 }
cl_int clGetDeviceInfo(cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: OpenCL.cpp:871

◆ get_cl_non_uniform_work_group_supported()

bool get_cl_non_uniform_work_group_supported ( const cl::Device &  device)

Helper function to check whether non-uniform work group is supported.

Parameters
[in]deviceA CL device
Returns
True if the feature is supported

Definition at line 395 of file CLHelpers.cpp.

References clGetDeviceInfo().

Referenced by CLDevice::is_non_uniform_workgroup_supported().

396 {
397  cl_bool supported = CL_FALSE;
398 
399  cl_int err = clGetDeviceInfo(device(), CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, sizeof(cl_bool), &supported, nullptr);
400 
401  return (err == CL_SUCCESS && supported == CL_TRUE);
402 }
cl_int clGetDeviceInfo(cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: OpenCL.cpp:871

◆ get_cl_promoted_type_from_data_type()

std::string get_cl_promoted_type_from_data_type ( const DataType dt)

Translates a tensor data type to the appropriate OpenCL promoted type.

Parameters
[in]dtDataType to be used to get the promoted OpenCL type.
Returns
The string specifying the OpenCL type to be used.

Definition at line 75 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, F16, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S8, U16, U32, and U8.

76 {
77  switch(dt)
78  {
79  case DataType::U8:
80  case DataType::QASYMM8:
81  return "ushort";
82  case DataType::S8:
83  case DataType::QASYMM8_SIGNED:
84  case DataType::QSYMM8:
85  case DataType::QSYMM8_PER_CHANNEL:
86  return "short";
87  case DataType::U16:
88  case DataType::QASYMM16:
89  return "uint";
90  case DataType::S16:
91  case DataType::QSYMM16:
92  return "int";
93  case DataType::U32:
94  return "ulong";
95  case DataType::S32:
96  return "long";
97  case DataType::F16:
98  return "float";
99  default:
100  ARM_COMPUTE_ERROR("Cannot get promoted OpenCL type for the input data type.");
101  return "";
102  }
103 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_select_type_from_data_type()

std::string get_cl_select_type_from_data_type ( const DataType dt)

Translates a tensor data type to the appropriate OpenCL select type.

Parameters
[in]dtDataType to be translated to OpenCL select type.
Returns
The string specifying the OpenCL select type to be used.

Definition at line 141 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, U16, U32, U64, and U8.

142 {
143  switch(dt)
144  {
145  case DataType::U8:
146  case DataType::QASYMM8:
147  return "uchar";
148  case DataType::S8:
149  case DataType::QASYMM8_SIGNED:
150  case DataType::QSYMM8:
151  case DataType::QSYMM8_PER_CHANNEL:
152  return "char";
153  case DataType::U16:
154  case DataType::QASYMM16:
155  return "ushort";
156  case DataType::F16:
157  case DataType::S16:
158  case DataType::QSYMM16:
159  return "short";
160  case DataType::U32:
161  return "uint";
162  case DataType::F32:
163  case DataType::S32:
164  return "int";
165  case DataType::U64:
166  return "ulong";
167  case DataType::S64:
168  return "long";
169  default:
170  ARM_COMPUTE_ERROR("Unsupported input data type.");
171  return "";
172  }
173 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_signed_type_from_element_size()

std::string get_cl_signed_type_from_element_size ( size_t  element_size)

Translates the element size to an signed integer data type.

Parameters
[in]element_sizeSize in bytes of an element.
Returns
The string specifying the OpenCL type to be used.

Definition at line 123 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR.

124 {
125  switch(element_size)
126  {
127  case 1:
128  return "char";
129  case 2:
130  return "short";
131  case 4:
132  return "int";
133  case 8:
134  return "long";
135  default:
136  ARM_COMPUTE_ERROR("Data type not supported");
137  return "";
138  }
139 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_type_from_data_type()

std::string get_cl_type_from_data_type ( const DataType dt)

Translates a tensor data type to the appropriate OpenCL type.

Parameters
[in]dtDataType to be translated to OpenCL type.
Returns
The string specifying the OpenCL type to be used.

Definition at line 39 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, U16, U32, U64, and U8.

Referenced by ClDequantizeKernel::configure(), ClFloorKernel::configure(), ClCopyKernel::configure(), ClElementWiseUnaryKernel::configure(), ClFillKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClPool3dKernel::configure(), ClPool2dKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClQuantizeKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), ClCropKernel::configure(), ClDepthConcatenateKernel::configure(), ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CLBatchToSpaceLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), ClCastKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLComputeAllAnchorsKernel::configure(), CLFFTScaleKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLNormalizationLayerKernel::configure(), CLComparisonKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), CLFFTDigitReverseKernel::configure(), CLReorgLayerKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), ClDirectConv2dKernel::configure(), CLRangeKernel::configure(), CLReductionOperationKernel::configure(), ClCol2ImKernel::configure(), CLPadLayerKernel::configure(), CLFFTRadixStageKernel::configure(), CLPriorBoxLayerKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClDirectConv3dKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLROIPoolingLayerKernel::configure(), CLStackLayerKernel::configure(), CLFillBorderKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLArgMinMaxLayerKernel::configure(), CLROIAlignLayerKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLFuseBatchNormalizationKernel::configure(), CLBatchNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClLogits1DNormKernel::configure(), ClComplexMulKernel::configure(), CLComputeMeanVariance::configure(), ClGemmLowpMatrixBReductionKernel::configure(), ClStoreBlockBoundaryAwareKernelComponent::generate_build_options(), ClDirectConvolutionKernelComponent::get_tag_lut(), ClFloorKernelComponent::get_tag_lut(), ClElementwiseKernelComponent::get_tag_lut(), ClTemplateDirectConv2d::get_tag_lut(), TagVal::TagVal(), and IClKernelComponent::TagVal::TagVal().

40 {
41  switch(dt)
42  {
43  case DataType::U8:
44  case DataType::QASYMM8:
45  return "uchar";
46  case DataType::S8:
47  case DataType::QASYMM8_SIGNED:
48  case DataType::QSYMM8:
49  case DataType::QSYMM8_PER_CHANNEL:
50  return "char";
51  case DataType::U16:
52  case DataType::QASYMM16:
53  return "ushort";
54  case DataType::S16:
55  case DataType::QSYMM16:
56  return "short";
57  case DataType::U32:
58  return "uint";
59  case DataType::S32:
60  return "int";
61  case DataType::U64:
62  return "ulong";
63  case DataType::S64:
64  return "long";
65  case DataType::F16:
66  return "half";
67  case DataType::F32:
68  return "float";
69  default:
70  ARM_COMPUTE_ERROR("Unsupported input data type.");
71  return "";
72  }
73 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_unsigned_type_from_element_size()

std::string get_cl_unsigned_type_from_element_size ( size_t  element_size)

Translates the element size to an unsigned integer data type.

Parameters
[in]element_sizeSize in bytes of an element.
Returns
The string specifying the OpenCL type to be used.

Definition at line 105 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR.

Referenced by ClReshapeKernel::configure(), ClHeightConcatenateKernel::configure(), ClPermuteKernel::configure(), CLStridedSliceKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), CLSelectKernel::configure(), CLChannelShuffleLayerKernel::configure(), CLReverseKernel::configure(), CLDepthToSpaceLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), CLDeconvolutionLayerUpsampleKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLGatherKernel::configure(), CLTileKernel::configure(), ClGemmReshapeRhsMatrixKernel::configure(), ClWeightsReshapeKernel::configure(), and CLBatchToSpaceLayerKernel::configure().

106 {
107  switch(element_size)
108  {
109  case 1:
110  return "uchar";
111  case 2:
112  return "ushort";
113  case 4:
114  return "uint";
115  case 8:
116  return "ulong";
117  default:
118  ARM_COMPUTE_ERROR("Data type not supported");
119  return "";
120  }
121 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_cl_version()

CLVersion get_cl_version ( const cl::Device &  device)

Helper function to get the highest OpenCL version supported.

Parameters
[in]deviceA CL device
Returns
the highest OpenCL version supported

Definition at line 256 of file CLHelpers.cpp.

References CL10, CL11, CL12, CL20, CL30, and UNKNOWN.

Referenced by CLDevice::CLDevice().

257 {
258  std::string version_str = device.getInfo<CL_DEVICE_VERSION>();
259  if(version_str.find("OpenCL 3") != std::string::npos)
260  {
261  return CLVersion::CL30;
262  }
263  else if(version_str.find("OpenCL 2") != std::string::npos)
264  {
265  return CLVersion::CL20;
266  }
267  else if(version_str.find("OpenCL 1.2") != std::string::npos)
268  {
269  return CLVersion::CL12;
270  }
271  else if(version_str.find("OpenCL 1.1") != std::string::npos)
272  {
273  return CLVersion::CL11;
274  }
275  else if(version_str.find("OpenCL 1.0") != std::string::npos)
276  {
277  return CLVersion::CL10;
278  }
279 
280  return CLVersion::UNKNOWN;
281 }
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ get_data_layout_dimension_index()

size_t get_data_layout_dimension_index ( const DataLayout data_layout,
const DataLayoutDimension data_layout_dimension 
)
inline

Get the index of the given dimension.

Parameters
[in]data_layoutThe data layout.
[in]data_layout_dimensionThe dimension which this index is requested for.
Returns
The int conversion of the requested data layout index.

Definition at line 193 of file Helpers.inl.

References ARM_COMPUTE_ERROR_ON_MSG, get_layout_map(), and UNKNOWN.

Referenced by calculate_same_pad(), calculate_valid_region_scale(), arm_compute::misc::shape_calculator::compute_batch_to_space_shape(), arm_compute::misc::shape_calculator::compute_col2im_shape(), arm_compute::misc::shape_calculator::compute_deconvolution_output_shape(), arm_compute::misc::shape_calculator::compute_deconvolution_upsampled_shape(), arm_compute::misc::shape_calculator::compute_deep_convolution_shape(), arm_compute::misc::shape_calculator::compute_depth_to_space_shape(), arm_compute::misc::shape_calculator::compute_depthwise_convolution_shape(), arm_compute::misc::shape_calculator::compute_im2col_conv_shape(), arm_compute::misc::shape_calculator::compute_pool3d_shape(), arm_compute::misc::shape_calculator::compute_pool_shape(), arm_compute::misc::shape_calculator::compute_prior_box_shape(), arm_compute::misc::shape_calculator::compute_reorg_output_shape(), arm_compute::misc::shape_calculator::compute_roi_align_shape(), arm_compute::misc::shape_calculator::compute_space_to_batch_shape(), arm_compute::misc::shape_calculator::compute_space_to_depth_shape(), arm_compute::misc::shape_calculator::compute_unpool_shape(), arm_compute::misc::shape_calculator::compute_upsample_shape(), arm_compute::misc::shape_calculator::compute_vector_to_tensor_output_shape(), arm_compute::misc::shape_calculator::compute_winograd_filter_transform_shape(), arm_compute::misc::shape_calculator::compute_winograd_input_transform_shape(), arm_compute::misc::shape_calculator::compute_winograd_output_transform_shape(), CpuScale::configure(), ClScaleKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), CpuPool2dKernel::configure(), CpuConvertFullyConnectedWeightsKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), CpuDirectConv2dKernel::configure(), CpuPool2d::configure(), CpuPool3dKernel::configure(), ClWinogradInputTransformKernel::configure(), CpuScaleKernel::configure(), CLChannelShuffleLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLDepthToSpaceLayerKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLReorgLayerKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), ClDirectConv2dKernel::configure(), CLPriorBoxLayerKernel::configure(), NERNNLayer::configure(), NEScale::configure(), CLROIAlignLayerKernel::configure(), ClIm2ColKernel::configure(), CpuIm2ColKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLRNNLayer::configure(), CLDepthwiseConvolutionLayer::configure(), ClWinogradConv2d::configure(), NEFFTConvolutionLayer::configure(), NEGenerateProposalsLayer::configure(), ClGemmConv2d::configure(), CpuGemmConv2d::configure(), CLComputeMeanVariance::configure(), NEDeconvolutionLayer::configure(), CLFFTConvolutionLayer::configure(), CLGenerateProposalsLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), ROIAlignLayerNode::configure_output(), arm_compute::test::validation::reference::convert_fully_connected_weights(), arm_compute::test::validation::DATA_TEST_CASE(), SubTensorInfo::dimension(), TensorInfo::dimension(), IImageLoader::fill_planar_tensor(), ClDirectConvolutionKernelComponent::generate_build_options(), ClTemplateDirectConv2d::get_build_options(), ClDirectConvolutionKernelComponent::get_component_code(), ClTemplateDirectConv2d::get_component_code(), ClTemplateDirectConv2d::get_config_id(), CpuConv2d::get_convolution_method(), ClConv2d::get_convolution_method(), CLDeconvolutionLayer::get_deconvolution_method(), get_normalization_dimension_index(), ClDirectConvolutionKernelComponent::get_tag_lut(), CpuGemmConv2d::has_opt_impl(), permute(), CpuScale::prepare(), CaffePreproccessor::preprocess(), arm_compute::cpu::roi_align(), CPPUpsampleKernel::run(), NEDepthToSpaceLayerKernel::run(), NESpaceToDepthLayerKernel::run(), NEReorgLayerKernel::run(), CLDeconvolutionLayerUpsampleKernel::run(), NESpaceToBatchLayerKernel::run(), CLROIAlignLayerKernel::run(), CpuGemmConv2d::run(), ClWinogradInputTransformKernel::run_op(), Conv2dContent::select_conv_method(), CpuScale::validate(), CpuPool2dKernel::validate(), CLDeconvolutionLayerUpsampleKernel::validate(), NERNNLayer::validate(), CLRNNLayer::validate(), ClComponentDirectConv2d::validate(), CLDepthwiseConvolutionLayer::validate(), ClGemmConv2d::validate(), NEGenerateProposalsLayer::validate(), CpuGemmConv2d::validate(), NEFFTConvolutionLayer::validate(), NEDeconvolutionLayer::validate(), ClDirectConv2dKernel::validate(), CLFFTConvolutionLayer::validate(), CLGenerateProposalsLayer::validate(), CLGEMMDeconvolutionLayer::validate(), CLDirectDeconvolutionLayer::validate(), arm_compute::cpu::kernels::validate_arguments(), and arm_compute::test::validation::reference::winograd_output_transform().

194 {
195  ARM_COMPUTE_ERROR_ON_MSG(data_layout == DataLayout::UNKNOWN, "Cannot retrieve the dimension index for an unknown layout!");
196  const auto &dims = get_layout_map().at(data_layout);
197  const auto &it = std::find(dims.cbegin(), dims.cend(), data_layout_dimension);
198  ARM_COMPUTE_ERROR_ON_MSG(it == dims.cend(), "Invalid dimension for the given layout.");
199  return it - dims.cbegin();
200 }
Unknown CL kernel type.
Definition: CLTypes.h:82
const std::map< DataLayout, std::vector< DataLayoutDimension > > & get_layout_map()
Returns a static map used to find an index or dimension based on a data layout.
Definition: Helpers.cpp:104
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ get_data_size_from_data_type()

std::string get_data_size_from_data_type ( const DataType dt)

Get the size of a data type in number of bits.

Parameters
[in]dtDataType.
Returns
Number of bits in the data type specified.

Definition at line 193 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, U16, U32, U64, and U8.

Referenced by ClDirectConv2dKernel::configure(), CLROIPoolingLayerKernel::configure(), and CLROIAlignLayerKernel::configure().

194 {
195  switch(dt)
196  {
197  case DataType::U8:
198  case DataType::S8:
199  case DataType::QSYMM8:
200  case DataType::QASYMM8:
201  case DataType::QASYMM8_SIGNED:
202  case DataType::QSYMM8_PER_CHANNEL:
203  return "8";
204  case DataType::U16:
205  case DataType::S16:
206  case DataType::QSYMM16:
207  case DataType::QASYMM16:
208  case DataType::F16:
209  return "16";
210  case DataType::U32:
211  case DataType::S32:
212  case DataType::F32:
213  return "32";
214  case DataType::U64:
215  case DataType::S64:
216  return "64";
217  default:
218  ARM_COMPUTE_ERROR("Unsupported input data type.");
219  return "0";
220  }
221 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_default_lws_for_type()

cl::NDRange get_default_lws_for_type ( CLKernelType  kernel_type,
cl::NDRange  gws 
)

Definition at line 97 of file DefaultLWSHeuristics.cpp.

References CLKernelLibrary::default_ndrange(), DEPTHWISE, DIRECT, GEMM, CLKernelLibrary::get(), and WINOGRAD.

98 {
99  const size_t gws_x = gws[0];
100  const size_t gws_y = gws[1];
101  const size_t gws_z = gws[2];
102 
103  switch(kernel_type)
104  {
105  case CLKernelType::GEMM:
106  {
107  return get_gemm_lws(gws_x, gws_y, gws_z);
108  }
110  {
111  return get_direct_lws(gws_x, gws_y, gws_z);
112  }
114  {
115  return get_winograd_lws(gws_x, gws_y, gws_z);
116  }
118  {
119  return get_dwc_lws(gws_x, gws_y, gws_z);
120  }
121  default:
122  {
123  return CLKernelLibrary::get().default_ndrange();
124  }
125  }
126 }
Winograd CL kernel type.
Definition: CLTypes.h:88
Depthwise CL kernel type.
Definition: CLTypes.h:83
GEMM CL kernel type.
Definition: CLTypes.h:86
Direct Convolution CL kernel type.
Definition: CLTypes.h:84

◆ get_index_data_layout_dimension()

DataLayoutDimension get_index_data_layout_dimension ( const DataLayout data_layout,
const size_t  index 
)
inline

Get the DataLayoutDimension of a given index and layout.

Parameters
[in]data_layoutThe data layout.
[in]indexThe data layout index.
Returns
The dimension which this index is requested for.

Definition at line 202 of file Helpers.inl.

References ARM_COMPUTE_ERROR_ON_MSG, get_layout_map(), and UNKNOWN.

Referenced by permute().

203 {
204  ARM_COMPUTE_ERROR_ON_MSG(data_layout == DataLayout::UNKNOWN, "Cannot retrieve the layout dimension for an unknown layout!");
205  const auto &dims = get_layout_map().at(data_layout);
206  ARM_COMPUTE_ERROR_ON_MSG(index >= dims.size(), "Invalid index for the given layout.");
207  return dims[index];
208 }
Unknown CL kernel type.
Definition: CLTypes.h:82
const std::map< DataLayout, std::vector< DataLayoutDimension > > & get_layout_map()
Returns a static map used to find an index or dimension based on a data layout.
Definition: Helpers.cpp:104
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ get_internal() [1/5]

IQueue* arm_compute::get_internal ( AclQueue  queue)
inline

Extract internal representation of a Queue.

Parameters
[in]queueOpaque queue pointer
Returns
The internal representation as an IQueue

Definition at line 76 of file IQueue.h.

77 {
78  return static_cast<IQueue *>(queue);
79 }

◆ get_internal() [2/5]

TensorPack* arm_compute::get_internal ( AclTensorPack  pack)
inline

Extract internal representation of a TensoPack.

Parameters
[in]packOpaque tensor pack pointer
Returns
The internal representation as an TensorPack

Definition at line 106 of file TensorPack.h.

References arm_compute::test::validation::pack.

107 {
108  return static_cast<TensorPack *>(pack);
109 }

◆ get_internal() [3/5]

IOperator* arm_compute::get_internal ( AclOperator  op)
inline

Extract internal representation of an Operator.

Parameters
[in]opOpaque operator pointer
Returns
The internal representation as an IOperator

Definition at line 112 of file IOperator.h.

113 {
114  return static_cast<IOperator *>(op);
115 }

◆ get_internal() [4/5]

ITensorV2* arm_compute::get_internal ( AclTensor  tensor)
inline

Extract internal representation of a Tensor.

Parameters
[in]tensorOpaque tensor pointer
Returns
The internal representation as an ITensor

Definition at line 116 of file ITensorV2.h.

References tensor.

117 {
118  return static_cast<ITensorV2 *>(tensor);
119 }
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ get_internal() [5/5]

IContext* arm_compute::get_internal ( AclContext  ctx)
inline

Extract internal representation of a Context.

Parameters
[in]ctxOpaque context pointer
Returns
The internal representation as an IContext

Definition at line 127 of file IContext.h.

Referenced by AclActivation(), AclCreateQueue(), AclCreateTensor(), AclCreateTensorPack(), AclDestroyContext(), AclDestroyOperator(), AclDestroyQueue(), AclDestroyTensor(), AclDestroyTensorPack(), AclGetClContext(), AclGetClDevice(), AclGetClMem(), AclGetClQueue(), AclMapTensor(), AclPackTensor(), AclPackTensors(), AclQueueFinish(), AclRunOperator(), AclSetClContext(), AclSetClQueue(), AclTensorImport(), and AclUnmapTensor().

128 {
129  return static_cast<IContext *>(ctx);
130 }

◆ get_layout_map()

const std::map< DataLayout, std::vector< DataLayoutDimension > > & get_layout_map ( )

Returns a static map used to find an index or dimension based on a data layout.

*** Layouts ***

*** 4D *** [N C H W] [3 2 1 0] [N H W C]

  • *** 5D *** [N C D H W] [4 3 2 1 0] [N D H W C]

Definition at line 104 of file Helpers.cpp.

References BATCHES, CHANNEL, DEPTH, HEIGHT, N, NCDHW, NCHW, NDHWC, NHWC, and WIDTH.

Referenced by get_data_layout_dimension_index(), get_index_data_layout_dimension(), and permute().

105 {
106  constexpr DataLayoutDimension W = DataLayoutDimension::WIDTH;
107  constexpr DataLayoutDimension H = DataLayoutDimension::HEIGHT;
108  constexpr DataLayoutDimension C = DataLayoutDimension::CHANNEL;
109  constexpr DataLayoutDimension D = DataLayoutDimension::DEPTH;
110  constexpr DataLayoutDimension N = DataLayoutDimension::BATCHES;
111 
112  static const std::map<DataLayout, std::vector<DataLayoutDimension>> layout_map =
113  {
114  { DataLayout::NDHWC, { C, W, H, D, N } },
115  { DataLayout::NCDHW, { W, H, D, C, N } },
116  { DataLayout::NHWC, { C, W, H, N } },
117  { DataLayout::NCHW, { W, H, C, N } }
118  };
119 
120  return layout_map;
121 }
DataLayoutDimension
[DataLayout enum definition]
Definition: Types.h:124
unsigned int N

◆ get_min_max()

std::tuple<PixelValue, PixelValue> arm_compute::get_min_max ( DataType  dt)
inline

Compute the mininum and maximum values a data type can take.

Parameters
[in]dtData type to get the min/max bounds of
Returns
A tuple (min,max) with the minimum and maximum values respectively wrapped in PixelValue.

Definition at line 564 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, bfloat16::lowest(), arm_compute::support::cpp11::lowest(), bfloat16::max(), QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S8, U16, U32, and U8.

Referenced by ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), ClGemmConv2d::configure(), get_quantized_activation_min_max(), and CpuGemmLowpOffsetContributionOutputStageKernel::run_op().

565 {
566  PixelValue min{};
567  PixelValue max{};
568  switch(dt)
569  {
570  case DataType::U8:
571  case DataType::QASYMM8:
572  {
573  min = PixelValue(static_cast<int32_t>(std::numeric_limits<uint8_t>::lowest()));
574  max = PixelValue(static_cast<int32_t>(std::numeric_limits<uint8_t>::max()));
575  break;
576  }
577  case DataType::S8:
578  case DataType::QSYMM8:
579  case DataType::QASYMM8_SIGNED:
580  case DataType::QSYMM8_PER_CHANNEL:
581  {
582  min = PixelValue(static_cast<int32_t>(std::numeric_limits<int8_t>::lowest()));
583  max = PixelValue(static_cast<int32_t>(std::numeric_limits<int8_t>::max()));
584  break;
585  }
586  case DataType::U16:
587  case DataType::QASYMM16:
588  {
589  min = PixelValue(static_cast<int32_t>(std::numeric_limits<uint16_t>::lowest()));
590  max = PixelValue(static_cast<int32_t>(std::numeric_limits<uint16_t>::max()));
591  break;
592  }
593  case DataType::S16:
594  case DataType::QSYMM16:
595  {
596  min = PixelValue(static_cast<int32_t>(std::numeric_limits<int16_t>::lowest()));
597  max = PixelValue(static_cast<int32_t>(std::numeric_limits<int16_t>::max()));
598  break;
599  }
600  case DataType::U32:
601  {
602  min = PixelValue(std::numeric_limits<uint32_t>::lowest());
603  max = PixelValue(std::numeric_limits<uint32_t>::max());
604  break;
605  }
606  case DataType::S32:
607  {
608  min = PixelValue(std::numeric_limits<int32_t>::lowest());
609  max = PixelValue(std::numeric_limits<int32_t>::max());
610  break;
611  }
612  case DataType::BFLOAT16:
613  {
614  min = PixelValue(bfloat16::lowest());
615  max = PixelValue(bfloat16::max());
616  break;
617  }
618  case DataType::F16:
619  {
620  min = PixelValue(std::numeric_limits<half>::lowest());
621  max = PixelValue(std::numeric_limits<half>::max());
622  break;
623  }
624  case DataType::F32:
625  {
626  min = PixelValue(std::numeric_limits<float>::lowest());
627  max = PixelValue(std::numeric_limits<float>::max());
628  break;
629  }
630  default:
631  ARM_COMPUTE_ERROR("Undefined data type!");
632  }
633  return std::make_tuple(min, max);
634 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_next_power_two()

unsigned int arm_compute::get_next_power_two ( unsigned int  x)
inline

Given an integer value, this function returns the next power of two.

Parameters
[in]xInput value
Returns
the next power of two

Definition at line 74 of file Utils.h.

Referenced by enqueue().

75 {
76  // Decrement by 1
77  x--;
78 
79  // Shift right by 1
80  x |= x >> 1u;
81  // Shift right by 2
82  x |= x >> 2u;
83  // Shift right by 4
84  x |= x >> 4u;
85  // Shift right by 8
86  x |= x >> 8u;
87  // Shift right by 16
88  x |= x >> 16u;
89 
90  // Increment by 1
91  x++;
92 
93  return x;
94 }

◆ get_normalization_dimension_index()

unsigned int arm_compute::get_normalization_dimension_index ( DataLayout  layout,
const NormalizationLayerInfo info 
)
inline

Calculate the normalization dimension index for a given normalization type.

Parameters
[in]layoutData layout of the input and output tensor
[in]infoNormalization info
Returns
Normalization dimension index

Definition at line 39 of file NormalizationHelpers.h.

References CHANNEL, get_data_layout_dimension_index(), NormalizationLayerInfo::is_in_map(), and WIDTH.

Referenced by NENormalizationLayerKernel::configure(), and CLNormalizationLayerKernel::configure().

40 {
41  const unsigned int width_idx = get_data_layout_dimension_index(layout, DataLayoutDimension::WIDTH);
42  const unsigned int channel_idx = get_data_layout_dimension_index(layout, DataLayoutDimension::CHANNEL);
43 
44  return info.is_in_map() ? width_idx : channel_idx;
45 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Definition: Helpers.inl:193

◆ get_padding_info() [1/2]

std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info ( std::initializer_list< const ITensorInfo *>  infos)

Stores padding information before configuring a kernel.

Parameters
[in]infoslist of tensor infos to store the padding info for
Returns
An unordered map where each tensor info pointer is paired with its original padding info

Definition at line 588 of file Utils.cpp.

References arm_compute::test::validation::info.

Referenced by ClDequantizeKernel::configure(), ClFloorKernel::configure(), ClReshapeKernel::configure(), ClTransposeKernel::configure(), ClCopyKernel::configure(), ClElementWiseUnaryKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClHeightConcatenateKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClQuantizeKernel::configure(), ClPermuteKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), CLStridedSliceKernel::configure(), ClDepthConcatenateKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLBitwiseKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), ClWinogradInputTransformKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CLSelectKernel::configure(), CLChannelShuffleLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), CLReverseKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CLDepthToSpaceLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLDeconvolutionLayerUpsampleKernel::configure(), ClCastKernel::configure(), CLComputeAllAnchorsKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLGatherKernel::configure(), CLNormalizationLayerKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLFFTScaleKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CLFFTDigitReverseKernel::configure(), CLReorgLayerKernel::configure(), ClGemmLowpOffsetContributionKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLRangeKernel::configure(), CLReductionOperationKernel::configure(), CLPadLayerKernel::configure(), CLFFTRadixStageKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClMulKernel::configure(), CLBoundingBoxTransformKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLROIPoolingLayerKernel::configure(), CLFillBorderKernel::configure(), ClWeightsReshapeKernel::configure(), CLArgMinMaxLayerKernel::configure(), ClIm2ColKernel::configure(), CLROIAlignLayerKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), CLFuseBatchNormalizationKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClLogits1DNormKernel::configure(), ClComplexMulKernel::configure(), ClGemmLowpMatrixBReductionKernel::configure(), CLComputeMeanVariance::configure(), ClSaturatedArithmeticKernel::configure(), ClArithmeticKernel::configure(), and is_symmetric().

589 {
590  std::unordered_map<const ITensorInfo *, PaddingSize> res;
591 
592  for(const ITensorInfo *info : infos)
593  {
594  if(info)
595  {
596  res.insert({ info, info->padding() });
597  }
598  }
599 
600  return res;
601 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ get_padding_info() [2/2]

std::unordered_map< const ITensorInfo *, PaddingSize > get_padding_info ( std::initializer_list< const ITensor *>  tensors)

Stores padding information before configuring a kernel.

Parameters
[in]tensorslist of tensors to store the padding info for
Returns
An unordered map where each tensor info pointer is paired with its original padding info

Definition at line 573 of file Utils.cpp.

References CLTensor::info(), TensorInfo::padding(), and tensor.

574 {
575  std::unordered_map<const ITensorInfo *, PaddingSize> res;
576 
577  for(const ITensor *tensor : tensors)
578  {
579  if(tensor)
580  {
581  res.insert({ tensor->info(), tensor->info()->padding() });
582  }
583  }
584 
585  return res;
586 }
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ get_promoted_data_type()

DataType arm_compute::get_promoted_data_type ( DataType  dt)
inline

Return the promoted data type of a given data type.

Note
If promoted data type is not supported an error will be thrown
Parameters
[in]dtData type to get the promoted type of.
Returns
Promoted data type

Definition at line 528 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S8, U16, U32, U8, and UNKNOWN.

529 {
530  switch(dt)
531  {
532  case DataType::U8:
533  return DataType::U16;
534  case DataType::S8:
535  return DataType::S16;
536  case DataType::U16:
537  return DataType::U32;
538  case DataType::S16:
539  return DataType::S32;
540  case DataType::QSYMM8:
541  case DataType::QASYMM8:
542  case DataType::QASYMM8_SIGNED:
543  case DataType::QSYMM8_PER_CHANNEL:
544  case DataType::QSYMM16:
545  case DataType::QASYMM16:
546  case DataType::BFLOAT16:
547  case DataType::F16:
548  case DataType::U32:
549  case DataType::S32:
550  case DataType::F32:
551  ARM_COMPUTE_ERROR("Unsupported data type promotions!");
552  default:
553  ARM_COMPUTE_ERROR("Undefined data type!");
554  }
555  return DataType::UNKNOWN;
556 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ get_quantized_activation_min_max()

std::pair< int32_t, int32_t > get_quantized_activation_min_max ( ActivationLayerInfo  act_info,
DataType  data_type,
UniformQuantizationInfo  oq_info 
)

Returns a pair of minimum and maximum values for a quantized activation.

Parameters
[in]act_infoThe information for activation
[in]data_typeThe used data type
[in]oq_infoThe output quantization information
Returns
The pair with minimum and maximum values

Definition at line 558 of file Utils.cpp.

References ActivationLayerInfo::a(), ActivationLayerInfo::activation(), arm_compute::test::validation::b, ActivationLayerInfo::b(), get_min_max(), is_data_type_quantized_asymmetric_signed(), ActivationLayerInfo::LU_BOUNDED_RELU, UniformQuantizationInfo::offset, quantize_qasymm8(), quantize_qasymm8_signed(), and ActivationLayerInfo::RELU.

Referenced by CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmConv2d::configure(), permute_strides(), and ClGemmConv2d::validate().

559 {
560  const bool is_qasymm8_signed = is_data_type_quantized_asymmetric_signed(data_type);
561  const auto a = act_info.a();
562  const auto b = act_info.b();
563  const int a_int = is_qasymm8_signed ? quantize_qasymm8_signed(a, oq_info) : quantize_qasymm8(a, oq_info);
564  const int b_int = is_qasymm8_signed ? quantize_qasymm8_signed(b, oq_info) : quantize_qasymm8(b, oq_info);
565  const auto type_max_value = std::get<1>(get_min_max(data_type)).get<int32_t>();
566 
567  const int32_t min_activation = act_info.activation() != ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU ? oq_info.offset : b_int;
568  const int32_t max_activation = act_info.activation() == ActivationLayerInfo::ActivationFunction::RELU ? type_max_value : a_int;
569 
570  return std::make_pair(min_activation, max_activation);
571 }
SimpleTensor< float > b
Definition: DFT.cpp:157
int8_t quantize_qasymm8_signed(float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given a signed 8-bit asymmetric quantization scheme.
uchar quantize_qasymm8(float input, float offset, float scale)
Quantize a floating-point scalar value to 8-bit asymmetric.
Definition: helpers_asymm.h:47
bool is_data_type_quantized_asymmetric_signed(DataType dt)
Check if a given data type is of asymmetric quantized signed type.
Definition: Utils.h:1071
std::tuple< PixelValue, PixelValue > get_min_max(DataType dt)
Compute the mininum and maximum values a data type can take.
Definition: Utils.h:564

◆ get_softmax_output_quantization_info()

QuantizationInfo get_softmax_output_quantization_info ( DataType  input_type,
bool  is_log 
)

Returns output quantization information for softmax layer.

Parameters
[in]input_typeThe data type of the input tensor
[in]is_logTrue for log softmax
Returns
Quantization information for the output tensor

Definition at line 537 of file Utils.cpp.

References is_data_type_quantized_asymmetric_signed().

Referenced by CpuLogits1DSoftmaxKernel< IS_LOG >::configure(), ClLogits1DNormKernel::configure(), SoftmaxLayerNode::configure_output(), CpuLogits1DMaxKernel::name(), permute_strides(), and arm_compute::test::validation::reference::softmax_layer().

538 {
539  // Note: Output quantization info for softmax should always have
540  // * Softmax with QASYMM8: scale = 1/256, offset = 0
541  // * Softmax with QASYMM8_SIGNED: scale = 1/256, offset = -128
542  // * LogSoftmax with QASYMM8: scale = 1/256, offset = 0
543  // * LogSoftmax with QASYMM8_SIGNED: scale = 16/256, offset = 127
545  {
546  if(is_log)
547  {
548  return QuantizationInfo(16.f / 256, 127);
549  }
550  else
551  {
552  return QuantizationInfo(1.f / 256, -128);
553  }
554  }
555  return QuantizationInfo(1.f / 256, 0);
556 }
bool is_data_type_quantized_asymmetric_signed(DataType dt)
Check if a given data type is of asymmetric quantized signed type.
Definition: Utils.h:1071

◆ get_target_from_device()

GPUTarget get_target_from_device ( const cl::Device &  device)

Helper function to get the GPU target from CL device.

Parameters
[in]deviceA CL device
Returns
the GPU target

Definition at line 223 of file CLHelpers.cpp.

References get_target_from_name().

Referenced by CLCompileContext::default_ndrange(), CLScheduler::init(), and ICLKernel::set_target().

224 {
225  // Query device name size
226  std::string device_name = device.getInfo<CL_DEVICE_NAME>();
227 
228  return get_target_from_name(device_name);
229 }
GPUTarget get_target_from_name(const std::string &device_name)
Helper function to get the GPU target from a device name.
Definition: GPUTarget.cpp:186

◆ get_target_from_name()

GPUTarget get_target_from_name ( const std::string &  device_name)

Helper function to get the GPU target from a device name.

Parameters
[in]device_nameA device name
Returns
the GPU target

Definition at line 186 of file GPUTarget.cpp.

References ARM_COMPUTE_LOG_INFO_MSG_CORE, BIFROST, MIDGARD, UNKNOWN, and VALHALL.

Referenced by CLDevice::CLDevice(), dot8_supported(), get_target_from_device(), and arm_compute::test::validation::TEST_CASE().

187 {
188  std::regex mali_regex(R"(Mali-(.*))");
189  std::smatch name_parts;
190  const bool found_mali = std::regex_search(device_name, name_parts, mali_regex);
191 
192  if(!found_mali)
193  {
194  ARM_COMPUTE_LOG_INFO_MSG_CORE("Can't find valid Arm® Maliâ„¢ GPU. Target is set to default.");
195  return GPUTarget::MIDGARD;
196  }
197 
198  const char target = name_parts.str(1)[0];
199  const std::string &version = name_parts.str(1);
200 
201  std::regex future_regex(R"(.*X)");
202  const bool is_future_gpu = std::regex_search(version, future_regex);
203 
204  // Work-out gpu target
205  GPUTarget gpu_target;
206  if(target == 'G' || is_future_gpu)
207  {
208  // Check for Valhall or Bifrost
209  gpu_target = get_valhall_target(version);
210  if(gpu_target == GPUTarget::UNKNOWN)
211  {
212  gpu_target = get_bifrost_target(version);
213  }
214 
215  // Default GPUTarget
216  if(gpu_target == GPUTarget::UNKNOWN)
217  {
218  gpu_target = GPUTarget::VALHALL;
219  }
220  }
221  else if(target == 'T')
222  {
223  gpu_target = get_midgard_target(version);
224  }
225  else
226  {
227  gpu_target = GPUTarget::UNKNOWN;
228  }
229 
230  // Report in case of unknown target
231  if(gpu_target == GPUTarget::UNKNOWN)
232  {
233  ARM_COMPUTE_LOG_INFO_MSG_CORE("Arm® Maliâ„¢ Mali GPU unknown. Target is set to the default one. (BIFROST)");
234  return GPUTarget::BIFROST;
235  }
236 
237  return gpu_target;
238 }
Unknown CL kernel type.
Definition: CLTypes.h:82
GPUTarget
Available GPU Targets.
Definition: GPUTarget.h:34
#define ARM_COMPUTE_LOG_INFO_MSG_CORE(msg)
Log information level message to the core system logger.
Definition: Log.h:87

◆ get_wbsm_support_info()

bool get_wbsm_support_info ( const cl::Device &  device)

Definition at line 423 of file CLHelpers.cpp.

References clGetDeviceInfo().

Referenced by CLCompileContext::CLCompileContext(), and CLCompileContext::set_device().

424 {
425  cl_bitfield capabilities = 0;
426  cl_int err = clGetDeviceInfo(device.get(), CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM, sizeof(cl_bitfield), &capabilities, nullptr);
427  if((err == CL_SUCCESS) && (capabilities & CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM))
428  {
429  return true;
430  }
431  return false;
432 }
cl_int clGetDeviceInfo(cl_device_id device, cl_device_info param_name, size_t param_value_size, void *param_value, size_t *param_value_size_ret)
Definition: OpenCL.cpp:871

◆ gpu_target_is_in() [1/2]

bool arm_compute::gpu_target_is_in ( GPUTarget  target_to_check,
GPUTarget  target,
Args...  targets 
)

Helper function to check whether a gpu target is equal to the provided targets.

Parameters
[in]target_to_checkgpu target to check
[in]targetFirst target to compare against
[in]targets(Optional) Additional targets to compare with
Returns
True if the target is equal with at least one of the targets.

Definition at line 106 of file GPUTarget.h.

Referenced by arm_compute::test::validation::TEST_CASE().

107 {
108  return (target_to_check == target) | gpu_target_is_in(target_to_check, targets...);
109 }
bool gpu_target_is_in(GPUTarget target_to_check, GPUTarget target)
Variant of gpu_target_is_in for comparing two targets.
Definition: GPUTarget.h:112

◆ gpu_target_is_in() [2/2]

bool arm_compute::gpu_target_is_in ( GPUTarget  target_to_check,
GPUTarget  target 
)
inline

Variant of gpu_target_is_in for comparing two targets.

Definition at line 112 of file GPUTarget.h.

113 {
114  return target_to_check == target;
115 }

◆ has_format_horizontal_subsampling()

bool arm_compute::has_format_horizontal_subsampling ( Format  format)
inline

Return true if the given format has horizontal subsampling.

Parameters
[in]formatFormat to determine subsampling.
Returns
True if the format can be subsampled horizontaly.

Definition at line 642 of file Utils.h.

References IYUV, NV12, NV21, UV88, UYVY422, and YUYV422.

Referenced by adjust_odd_shape(), and calculate_subsampled_shape().

643 {
644  return (format == Format::YUYV422 || format == Format::UYVY422 || format == Format::NV12 || format == Format::NV21 || format == Format::IYUV || format == Format::UV88) ? true : false;
645 }

◆ has_format_vertical_subsampling()

bool arm_compute::has_format_vertical_subsampling ( Format  format)
inline

Return true if the given format has vertical subsampling.

Parameters
[in]formatFormat to determine subsampling.
Returns
True if the format can be subsampled verticaly.

Definition at line 653 of file Utils.h.

References IYUV, NV12, NV21, and UV88.

Referenced by adjust_odd_shape(), and calculate_subsampled_shape().

654 {
655  return (format == Format::NV12 || format == Format::NV21 || format == Format::IYUV || format == Format::UV88) ? true : false;
656 }

◆ has_padding_changed()

bool has_padding_changed ( const std::unordered_map< const ITensorInfo *, PaddingSize > &  padding_map)

Check if the previously stored padding info has changed after configuring a kernel.

Parameters
[in]padding_mapan unordered map where each tensor info pointer is paired with its original padding info
Returns
true if any of the tensor infos has changed its paddings

Definition at line 603 of file Utils.cpp.

References ARM_COMPUTE_ERROR, BFLOAT16, dt, F16, F32, arm_compute::test::validation::n, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S8, U16, U32, and U8.

Referenced by ClDequantizeKernel::configure(), ClFloorKernel::configure(), ClReshapeKernel::configure(), ClTransposeKernel::configure(), ClCopyKernel::configure(), ClElementWiseUnaryKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClHeightConcatenateKernel::configure(), ClQuantizeKernel::configure(), ClPermuteKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), CLStridedSliceKernel::configure(), ClDepthConcatenateKernel::configure(), ClConvertFullyConnectedWeightsKernel::configure(), ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLBitwiseKernel::configure(), CLInstanceNormalizationLayerKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CLSelectKernel::configure(), CLChannelShuffleLayerKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFixedPointKernel::configure(), CLReverseKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLDepthToSpaceLayerKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLDeconvolutionLayerUpsampleKernel::configure(), CLComputeAllAnchorsKernel::configure(), ClCastKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleKernel::configure(), ClGemmLowpQuantizeDownInt32ScaleByFloatKernel::configure(), CLGatherKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLNormalizationLayerKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLFFTScaleKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), CLFFTDigitReverseKernel::configure(), CLReorgLayerKernel::configure(), ClGemmLowpOffsetContributionKernel::configure(), ClGemmLowpOffsetContributionOutputStageKernel::configure(), CLRangeKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLReductionOperationKernel::configure(), CLPadLayerKernel::configure(), CLFFTRadixStageKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLL2NormalizeLayerKernel::configure(), ClMulKernel::configure(), CLBoundingBoxTransformKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLROIPoolingLayerKernel::configure(), ClGemmLowpMatrixAReductionKernel::configure(), CLFillBorderKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), ClWeightsReshapeKernel::configure(), CLArgMinMaxLayerKernel::configure(), ClIm2ColKernel::configure(), CLROIAlignLayerKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), CLFuseBatchNormalizationKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClLogits1DNormKernel::configure(), ClComplexMulKernel::configure(), CLComputeMeanVariance::configure(), ClGemmLowpMatrixBReductionKernel::configure(), ClSaturatedArithmeticKernel::configure(), ClArithmeticKernel::configure(), and is_symmetric().

604 {
605  return std::find_if(padding_map.begin(), padding_map.end(), [](const std::pair<const ITensorInfo *, PaddingSize> &padding_info)
606  {
607  return (padding_info.first->padding() != padding_info.second);
608  })
609  != padding_map.end();
610 }

◆ ignore_unused()

void arm_compute::ignore_unused ( T &&  ...)
inline

Ignores unused arguments.

Template Parameters
TArgument types
Parameters
[in]...Ignored arguments

Definition at line 39 of file Error.h.

40 {
41 }

◆ image2d_from_buffer_supported()

bool image2d_from_buffer_supported ( const cl::Device &  device)

Helper function to check whether the cl_khr_image2d_from_buffer extension is supported.

Parameters
[in]deviceA CL device
Returns
True if the extension is supported

Definition at line 374 of file CLHelpers.cpp.

References device_supports_extension().

Referenced by arm_compute::test::validation::DATA_TEST_CASE(), export_to_cl_image(), arm_compute::experimental::dynamic_fusion::export_to_cl_image_support(), arm_compute::test::validation::FIXTURE_DATA_TEST_CASE(), and arm_compute::opencl::kernels::gemm::validate_image2d_support_on_rhs().

375 {
376  return device_supports_extension(device, "cl_khr_image2d_from_buffer");
377 }
bool device_supports_extension(const cl::Device &device, const char *extension_name)
Helper function to check whether a given extension is supported.
Definition: CLHelpers.cpp:283

◆ index2coords()

Coordinates index2coords ( const TensorShape shape,
int  index 
)
inline

Convert a linear index into n-dimensional coordinates.

Parameters
[in]shapeShape of the n-dimensional tensor.
[in]indexLinear index specifying the i-th element.
Returns
n-dimensional coordinates.

Definition at line 156 of file Helpers.inl.

References ARM_COMPUTE_ERROR_ON_MSG, Dimensions< T >::num_dimensions(), TensorShape::set(), and TensorShape::total_size().

Referenced by arm_compute::test::validation::reference::convert_fully_connected_weights(), DATA_TEST_CASE(), and permute().

157 {
158  int num_elements = shape.total_size();
159 
160  ARM_COMPUTE_ERROR_ON_MSG(index < 0 || index >= num_elements, "Index has to be in [0, num_elements]!");
161  ARM_COMPUTE_ERROR_ON_MSG(num_elements == 0, "Cannot create coordinate from empty shape!");
162 
163  Coordinates coord{ 0 };
164 
165  for(int d = shape.num_dimensions() - 1; d >= 0; --d)
166  {
167  num_elements /= shape[d];
168  coord.set(d, index / num_elements);
169  index %= num_elements;
170  }
171 
172  return coord;
173 }
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ interleave_by()

int arm_compute::interleave_by ( const WeightFormat  wf)
inline

Definition at line 2055 of file Types.h.

2056 {
2057  return (static_cast<int>(wf) >> 8) & 0xFFF;
2058 }

◆ intersect_valid_regions()

ValidRegion arm_compute::intersect_valid_regions ( const Ts &...  regions)

Intersect multiple valid regions.

Parameters
[in]regionsValid regions.
Returns
Intersection of all regions.

Definition at line 72 of file WindowHelpers.h.

References ValidRegion::anchor, TensorShape::broadcast_shape(), calculate_max_enlarged_window(), calculate_max_window(), calculate_max_window_horizontal(), calculate_squashed_or_max_window(), arm_compute::utility::foldl(), arm_compute::test::validation::info, Dimensions< T >::num_dimensions(), Dimensions< T >::set(), TensorShape::set(), arm_compute::test::validation::shape, ValidRegion::shape, arm_compute::test::validation::src, ITensorInfo::tensor_shape(), arm_compute::test::validation::valid_region, and ITensorInfo::valid_region().

73 {
74  auto intersect = [](const ValidRegion & r1, const ValidRegion & r2) -> ValidRegion
75  {
76  ValidRegion region;
77 
78  for(size_t d = 0; d < std::min(r1.anchor.num_dimensions(), r2.anchor.num_dimensions()); ++d)
79  {
80  region.anchor.set(d, std::max(r1.anchor[d], r2.anchor[d]));
81  }
82 
83  for(size_t d = 0; d < std::min(r1.shape.num_dimensions(), r2.shape.num_dimensions()); ++d)
84  {
85  region.shape.set(d, std::min(r1.shape[d], r2.shape[d]));
86  }
87 
88  return region;
89  };
90 
91  return utility::foldl(intersect, regions...);
92 }
T && foldl(F &&, T &&value)
Base case of foldl.
Definition: Utility.h:132

◆ is_data_type_float()

◆ is_data_type_quantized()

bool arm_compute::is_data_type_quantized ( DataType  dt)
inline

Check if a given data type is of quantized type.

Note
Quantized is considered a super-set of fixed-point and asymmetric data types.
Parameters
[in]dtInput data type.
Returns
True if data type is of quantized type, else false.

Definition at line 1030 of file Utils.h.

References QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, and QSYMM8_PER_CHANNEL.

Referenced by arm_compute::test::validation::reference::arithmetic_operation(), ClElementwiseKernel::ClElementwiseKernel(), ClActivationKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClCastKernel::configure(), CLComputeAllAnchorsKernel::configure(), CLComparisonKernel::configure(), CPPDetectionPostProcessLayer::configure(), CLReductionOperationKernel::configure(), ClDirectConv2dKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CpuGemmDirectConv2d::configure(), ClDirectConv3dKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), NEReduceMean::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLReduceMean::configure(), NEDetectionPostProcessLayer::configure(), CLDepthwiseConvolutionLayer::configure(), error_on_mismatching_quantization_info(), ClDirectConvolutionKernelComponent::generate_build_options(), ClTemplateDirectConv2d::get_build_options(), ClDirectConvolutionKernelComponent::get_component_code(), ClTemplateDirectConv2d::get_component_code(), needs_serialized_reduction(), operator<<(), QuantizationLayerNode::QuantizationLayerNode(), arm_compute::test::validation::reference::space_to_batch(), CpuDepthwiseConv2dAssemblyWrapperKernel::validate(), ClFullyConnected::validate(), NEDetectionPostProcessLayer::validate(), CpuFullyConnected::validate(), CLDepthwiseConvolutionLayer::validate(), and NEDeconvolutionLayer::validate().

1031 {
1032  switch(dt)
1033  {
1034  case DataType::QSYMM8:
1035  case DataType::QASYMM8:
1036  case DataType::QASYMM8_SIGNED:
1037  case DataType::QSYMM8_PER_CHANNEL:
1038  case DataType::QSYMM16:
1039  case DataType::QASYMM16:
1040  return true;
1041  default:
1042  return false;
1043  }
1044 }

◆ is_data_type_quantized_asymmetric()

bool arm_compute::is_data_type_quantized_asymmetric ( DataType  dt)
inline

Check if a given data type is of asymmetric quantized type.

Parameters
[in]dtInput data type.
Returns
True if data type is of asymmetric quantized type, else false.

Definition at line 1052 of file Utils.h.

References QASYMM16, QASYMM8, and QASYMM8_SIGNED.

Referenced by GraphBuilder::add_convolution_node(), GraphBuilder::add_deconvolution_node(), GraphBuilder::add_depthwise_convolution_node(), GraphBuilder::add_fully_connected_layer(), ClDequantizeKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenateKernel::configure(), ClActivationKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClQuantizeKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClSoftmax::configure(), ClBatchConcatenateKernel::configure(), ClDepthConcatenateKernel::configure(), ClDirectConv2d::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CpuSoftmaxGeneric< IS_LOG >::configure(), CLRangeKernel::configure(), ClMulKernel::configure(), CLROIPoolingLayerKernel::configure(), CLROIAlignLayerKernel::configure(), ClFullyConnected::configure(), CpuFullyConnected::configure(), CpuLogits1DSoftmaxKernel< IS_LOG >::configure(), ClLogits1DNormKernel::configure(), ClGemmConv2d::configure(), CpuGemmConv2d::configure(), CpuGemmLowpMatrixMultiplyCore::configure(), CLGEMMDeconvolutionLayer::configure(), arm_compute::test::convolution_3d::detail::convolution3d(), arm_compute::graph::backends::detail::create_concatenate_layer(), arm_compute::graph::backends::detail::create_convolution_layer(), arm_compute::graph::backends::detail::create_depthwise_convolution_layer(), arm_compute::graph::backends::detail::create_fully_connected_layer(), arm_compute::graph::backends::detail::create_fused_convolution_with_post_op(), arm_compute::test::validation::reference::im2col_nchw(), arm_compute::test::validation::reference::im2col_nhwc(), CpuLogits1DMaxKernel::name(), arm_compute::cpu::roi_align(), CpuGemmLowpMatrixMultiplyCore::run(), set_quantization_info_if_empty(), CpuQuantizeKernel::validate(), ClSoftmax::validate(), CpuGemmDirectConv2d::validate(), ClGemmLowpMatrixMultiplyCore::validate(), ClGemmConv2d::validate(), CpuGemmConv2d::validate(), CpuGemmLowpMatrixMultiplyCore::validate(), NEDeconvolutionLayer::validate(), CLGEMMDeconvolutionLayer::validate(), CLDirectDeconvolutionLayer::validate(), arm_compute::graph::backends::detail::validate_convolution_layer(), and arm_compute::graph::backends::detail::validate_fused_convolution_with_post_op().

1053 {
1054  switch(dt)
1055  {
1056  case DataType::QASYMM8:
1057  case DataType::QASYMM8_SIGNED:
1058  case DataType::QASYMM16:
1059  return true;
1060  default:
1061  return false;
1062  }
1063 }

◆ is_data_type_quantized_asymmetric_signed()

bool arm_compute::is_data_type_quantized_asymmetric_signed ( DataType  dt)
inline

Check if a given data type is of asymmetric quantized signed type.

Parameters
[in]dtInput data type.
Returns
True if data type is of asymmetric quantized signed type, else false.

Definition at line 1071 of file Utils.h.

References QASYMM8_SIGNED.

Referenced by CpuDirectConv2dOutputStageKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), ClLogits1DNormKernel::configure(), get_quantized_activation_min_max(), get_softmax_output_quantization_info(), and arm_compute::cpu::roi_align_1x1_qasymm8().

1072 {
1073  switch(dt)
1074  {
1075  case DataType::QASYMM8_SIGNED:
1076  return true;
1077  default:
1078  return false;
1079  }
1080 }

◆ is_data_type_quantized_per_channel()

◆ is_data_type_quantized_symmetric()

bool arm_compute::is_data_type_quantized_symmetric ( DataType  dt)
inline

Check if a given data type is of symmetric quantized type.

Parameters
[in]dtInput data type.
Returns
True if data type is of symmetric quantized type, else false.

Definition at line 1088 of file Utils.h.

References QSYMM16, QSYMM8, and QSYMM8_PER_CHANNEL.

Referenced by ClGemmLowpMatrixMultiplyCore::configure(), and ClGemmLowpMatrixMultiplyCore::validate().

1089 {
1090  switch(dt)
1091  {
1092  case DataType::QSYMM8:
1093  case DataType::QSYMM8_PER_CHANNEL:
1094  case DataType::QSYMM16:
1095  return true;
1096  default:
1097  return false;
1098  }
1099 }

◆ is_fixed_format()

bool arm_compute::is_fixed_format ( const WeightFormat wf)
inline

Definition at line 2063 of file Types.h.

References ANY, and UNSPECIFIED.

2064 {
2065  return wf != WeightFormat::UNSPECIFIED && wf != WeightFormat::ANY;
2066 }

◆ is_fixed_format_fast_math()

bool arm_compute::is_fixed_format_fast_math ( const WeightFormat wf)
inline

Definition at line 2067 of file Types.h.

Referenced by arm_compute::test::validation::combine().

2068 {
2069  return (static_cast<int>(wf) >> 4) & 0x1;
2070 }

◆ is_pool_3d_region_entirely_outside_input()

bool is_pool_3d_region_entirely_outside_input ( const Pooling3dLayerInfo info)

Check if the 3d pool region is entirely outside the input tensor.

Parameters
[in]infoPooling3dLayerInfo to be checked.
Returns
True if the pool region is entirely outside the input tensor, False otherwise.

Definition at line 249 of file Utils.cpp.

References Pooling3dLayerInfo::is_global_pooling, Pooling3dLayerInfo::padding, Pooling3dLayerInfo::pool_size, Size3D::x(), Size3D::y(), and Size3D::z().

Referenced by permute_strides().

250 {
251  if(info.is_global_pooling || info.pool_size.x() == 0 || info.pool_size.y() == 0 || info.pool_size.z() == 0)
252  {
253  return false;
254  }
255  const auto ps = info.padding;
256  const auto pool_le_padding_x = info.pool_size.x() <= std::max({ ps.left, ps.right });
257  const auto pool_le_padding_y = info.pool_size.y() <= std::max({ ps.top, ps.bottom });
258  const auto pool_le_padding_z = info.pool_size.z() <= std::max({ ps.front, ps.back });
259  return pool_le_padding_x || pool_le_padding_y || pool_le_padding_z;
260 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ is_pool_region_entirely_outside_input()

bool is_pool_region_entirely_outside_input ( const PoolingLayerInfo info)

Check if the pool region is entirely outside the input tensor.

Parameters
[in]infoPoolingLayerInfo to be checked.
Returns
True if the pool region is entirely outside the input tensor, False otherwise.

Definition at line 237 of file Utils.cpp.

References PoolingLayerInfo::exclude_padding, PoolingLayerInfo::is_global_pooling, PoolingLayerInfo::pad_stride_info, PoolingLayerInfo::pool_size, Size2D::x(), and Size2D::y().

Referenced by permute_strides(), and CpuPool2dAssemblyWrapperKernel::validate().

238 {
239  if(info.is_global_pooling || info.exclude_padding || info.pool_size.x() == 0 || info.pool_size.y() == 0)
240  {
241  return false;
242  }
243  const auto ps = info.pad_stride_info;
244  const auto pool_le_padding_x = info.pool_size.x() <= std::max({ ps.pad_left(), ps.pad_right() });
245  const auto pool_le_padding_y = info.pool_size.y() <= std::max({ ps.pad_top(), ps.pad_bottom() });
246  return pool_le_padding_x || pool_le_padding_y;
247 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ is_symmetric()

bool arm_compute::is_symmetric ( const Padding3D info)
inline

Check if the 3D padding is symmetric i.e.

padding in each opposite sides are euqal (left=right, top=bottom and front=back)

Parameters
[in]infoPadding3D input 3D padding object to check if it is symmetric
Returns
True if padding is symmetric

Definition at line 926 of file Utils.h.

References Padding3D::back, Padding3D::bottom, data_type_from_name(), Padding3D::front, get_padding_info(), has_padding_changed(), Padding3D::left, name, output_stage, Padding3D::right, string_from_gemmlowp_output_stage(), string_from_pixel_value(), and Padding3D::top.

927 {
928  return ((info.left == info.right) && (info.top == info.bottom) && (info.front == info.back));
929 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ lower_string()

std::string lower_string ( const std::string &  val)

Lower a given string.

Parameters
[in]valGiven string to lower.
Returns
The lowered string

Definition at line 353 of file Utils.cpp.

References arm_compute::utility::tolower().

Referenced by ClElementwiseKernel::ClElementwiseKernel(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClActivationKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), CLStridedSliceKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), CLReverseKernel::configure(), CLChannelShuffleLayerKernel::configure(), CLDepthToSpaceLayerKernel::configure(), CLBatchToSpaceLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLSpaceToDepthLayerKernel::configure(), ClCastKernel::configure(), CLNormalizationLayerKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLFFTScaleKernel::configure(), CLTileKernel::configure(), CLComparisonKernel::configure(), CLFFTDigitReverseKernel::configure(), CLReorgLayerKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClDirectConv2dKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLRangeKernel::configure(), ClCol2ImKernel::configure(), CLFFTRadixStageKernel::configure(), ClDirectConv3dKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLFillBorderKernel::configure(), ClIm2ColKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClComplexMulKernel::configure(), arm_compute::test::validation::DATA_TEST_CASE(), ClFloorKernelComponent::generate_config_id(), ClElementwiseKernelComponent::generate_config_id(), ClTemplateDirectConv2d::get_config_id(), arm_compute::graph_utils::get_input_accessor(), operator>>(), PostOpCLKernelUtils::set_post_ops_cl_build_options(), and ClSaturatedArithmeticKernel::validate().

354 {
355  std::string res = val;
356  std::transform(res.begin(), res.end(), res.begin(), ::tolower);
357  return res;
358 }
std::string tolower(std::string string)
Convert string to lower case.
Definition: Utility.h:205

◆ manage_workspace() [1/2]

WorkspaceData<TensorType> arm_compute::manage_workspace ( const experimental::MemoryRequirements mem_reqs,
MemoryGroup mgroup,
ITensorPack run_pack 
)

Definition at line 55 of file MemoryHelpers.h.

58 {
59  ITensorPack dummy_pack = ITensorPack();
60  return manage_workspace<TensorType>(mem_reqs, mgroup, run_pack, dummy_pack);
61 }

◆ manage_workspace() [2/2]

WorkspaceData<TensorType> arm_compute::manage_workspace ( const experimental::MemoryRequirements mem_reqs,
MemoryGroup mgroup,
ITensorPack run_pack,
ITensorPack prep_pack 
)

Definition at line 64 of file MemoryHelpers.h.

References ITensorPack::add_tensor(), ARM_COMPUTE_ERROR_ON_NULLPTR, MemoryGroup::manage(), WorkspaceDataElement< TensorType >::slot, arm_compute::experimental::Temporary, WorkspaceDataElement< TensorType >::tensor, and U8.

67 {
68  WorkspaceData<TensorType> workspace_memory;
69  for(const auto &req : mem_reqs)
70  {
71  if(req.size == 0)
72  {
73  continue;
74  }
75 
76  const auto aux_info = TensorInfo{ TensorShape(req.size), 1, DataType::U8 };
77  workspace_memory.emplace_back(WorkspaceDataElement<TensorType> { req.slot, req.lifetime, std::make_unique<TensorType>() });
78 
79  auto aux_tensor = workspace_memory.back().tensor.get();
80  ARM_COMPUTE_ERROR_ON_NULLPTR(aux_tensor);
81  aux_tensor->allocator()->init(aux_info, req.alignment);
82 
83  if(req.lifetime == experimental::MemoryLifetime::Temporary)
84  {
85  mgroup.manage(aux_tensor);
86  }
87  else
88  {
89  prep_pack.add_tensor(req.slot, aux_tensor);
90  }
91  run_pack.add_tensor(req.slot, aux_tensor);
92  }
93 
94  for(auto &mem : workspace_memory)
95  {
96  auto tensor = mem.tensor.get();
97  tensor->allocator()->allocate();
98  }
99 
100  return workspace_memory;
101 }
CLTensor * tensor
Pointer to the auxiliary tensor.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

◆ multiply_by_quantized_multiplier_2row()

int32x4x2_t arm_compute::multiply_by_quantized_multiplier_2row ( int32x4x2_t  input,
int32_t  qmul,
int32_t  shift 
)
inline

Multiply a neon vector using quantized multiplier and shift.

Parameters
[in]inputInput vector to mutiply values to be quantized.
[in]qmulQuantized multipler
[in]shiftLeft bit shift
Returns
A neon vector holding the multiplied value

Definition at line 242 of file NESymm.h.

References rounding_divide_by_pow2().

Referenced by NEQLSTMLayerNormalizationKernel::run().

243 {
244  const auto left_shift = shift > 0 ? shift : 0;
245  const auto right_shift = shift > 0 ? 0 : -shift;
246  const auto one_shifted = 1 << left_shift;
247 
248  int32x4x2_t result;
249  result.val[0] = rounding_divide_by_pow2(vqrdmulhq_n_s32(vmulq_n_s32(input.val[0], one_shifted), qmul), right_shift);
250  result.val[1] = rounding_divide_by_pow2(vqrdmulhq_n_s32(vmulq_n_s32(input.val[1], one_shifted), qmul), right_shift);
251 
252  return result;
253 }
int32_t rounding_divide_by_pow2(int32_t x, int exponent)
Round to the nearest division by a power-of-two using exponent, copied from NEMath.

◆ needs_serialized_reduction()

bool needs_serialized_reduction ( ReductionOperation  op,
DataType  dt,
unsigned int  axis 
)

Check if the given reduction operation should be handled in a serial way.

Parameters
[in]opReduction operation to perform
[in]dtData type
[in]axisAxis along which to reduce
Returns
True if the given reduction operation should be handled in a serial way.

Definition at line 528 of file Utils.cpp.

References is_data_type_quantized(), MAX, and MIN.

Referenced by CLReductionOperationKernel::configure(), permute_strides(), and CLReductionOperationKernel::run().

529 {
530  const bool is_min_max = (op == ReductionOperation::MAX || op == ReductionOperation::MIN);
531  const bool is_quantized_type = is_data_type_quantized(dt);
532  const bool is_first_dim = (axis == 0);
533 
534  return !is_first_dim || is_min_max || is_quantized_type;
535 }
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Definition: Utils.h:1030
#define MAX(x, y)
#define MIN(x, y)

◆ num_channels_from_format()

size_t arm_compute::num_channels_from_format ( Format  format)
inline

Return the number of channels for a given single-planar pixel format.

Parameters
[in]formatInput format
Returns
The number of channels for a given image format.

Definition at line 486 of file Utils.h.

References BFLOAT16, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UV88, UYVY422, YUV444, and YUYV422.

Referenced by TensorInfo::init(), TensorInfo::init_auto_padding(), and TensorInfo::set_format().

487 {
488  switch(format)
489  {
490  case Format::U8:
491  case Format::U16:
492  case Format::S16:
493  case Format::U32:
494  case Format::S32:
495  case Format::BFLOAT16:
496  case Format::F16:
497  case Format::F32:
498  return 1;
499  // Because the U and V channels are subsampled
500  // these formats appear like having only 2 channels:
501  case Format::YUYV422:
502  case Format::UYVY422:
503  return 2;
504  case Format::UV88:
505  return 2;
506  case Format::RGB888:
507  return 3;
508  case Format::RGBA8888:
509  return 4;
510  //Doesn't make sense for planar formats:
511  case Format::NV12:
512  case Format::NV21:
513  case Format::IYUV:
514  case Format::YUV444:
515  default:
516  return 0;
517  }
518 }

◆ num_of_elements_in_range()

size_t arm_compute::num_of_elements_in_range ( const float  start,
const float  end,
const float  step 
)
inline

Returns the number of elements required to go from start to end with the wanted step.

Parameters
[in]startstart value
[in]endend value
[in]stepstep value between each number in the wanted sequence
Returns
number of elements to go from start value to end value using the wanted step

Definition at line 1146 of file Utils.h.

References ARM_COMPUTE_ERROR_ON_MSG.

Referenced by NERangeKernel::configure().

1147 {
1148  ARM_COMPUTE_ERROR_ON_MSG(step == 0, "Range Step cannot be 0");
1149  return size_t(std::ceil((end - start) / step));
1150 }
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290
constexpr int step
Definition: fp32.cpp:35

◆ num_planes_from_format()

size_t arm_compute::num_planes_from_format ( Format  format)
inline

Return the number of planes for a given format.

Parameters
[in]formatInput format
Returns
The number of planes for a given image format.

Definition at line 451 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UYVY422, YUV444, and YUYV422.

452 {
453  switch(format)
454  {
455  case Format::U8:
456  case Format::S16:
457  case Format::U16:
458  case Format::S32:
459  case Format::U32:
460  case Format::BFLOAT16:
461  case Format::F16:
462  case Format::F32:
463  case Format::RGB888:
464  case Format::RGBA8888:
465  case Format::YUYV422:
466  case Format::UYVY422:
467  return 1;
468  case Format::NV12:
469  case Format::NV21:
470  return 2;
471  case Format::IYUV:
472  case Format::YUV444:
473  return 3;
474  default:
475  ARM_COMPUTE_ERROR("Not supported format");
476  return 0;
477  }
478 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ offset_int_vec()

◆ opencl_is_available()

bool opencl_is_available ( )

Check if OpenCL is available.

Returns
True if OpenCL is available.

Definition at line 188 of file OpenCL.cpp.

References CLSymbols::clBuildProgram_ptr, clGetPlatformIDs(), CLSymbols::get(), and CLSymbols::load_default().

Referenced by create_opencl_context_and_device(), CLScheduler::get(), CLDeviceBackend::is_backend_supported(), main(), Framework::run(), arm_compute::utils::run_example(), and arm_compute::test::sync_if_necessary().

189 {
190  CLSymbols::get().load_default();
191 
192  // Using static objects that rely on OpenCL in their constructor or
193  // destructor is implementation defined according to the OpenCL API
194  // Specification. These objects include CLScheduler.
195  //
196  // For compatibility with OpenCL runtimes that also use static objects to
197  // hold their state, we call a harmless OpenCL function (clGetPlatformIDs
198  // with invalid parameters must result in CL_INVALID_VALUE) to ensure the
199  // runtimes have a chance to initialize their static objects first. Thanks
200  // to C++11 rules about normal program completion (cf [basic.start]), this
201  // ensures their static objects are destroyed last, i.e. after the
202  // singleton CLScheduler is destroyed.
203  //
204  // When OpenCL is not available, this call results in CL_OUT_OF_RESOURCES,
205  // which is equally harmless.
206  (void)clGetPlatformIDs(0, nullptr, nullptr);
207 
208  return CLSymbols::get().clBuildProgram_ptr != nullptr;
209 }
cl_int clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms, cl_uint *num_platforms)
Definition: OpenCL.cpp:939

◆ operator!=() [1/3]

bool arm_compute::operator!= ( const QuantizationInfo lhs,
const QuantizationInfo rhs 
)
inline

Check whether two quantization info are not equal.

Parameters
[in]lhsRHS quantization info.
[in]rhsLHS quantization info.
Returns
True if the given quantization info is the same.

Definition at line 183 of file QuantizationInfo.h.

References operator==().

184 {
185  return !(operator==(lhs, rhs));
186 }
bool operator==(const UniformQuantizationInfo &lhs, const UniformQuantizationInfo &rhs)
Check whether two quantization info are equal.

◆ operator!=() [2/3]

bool arm_compute::operator!= ( const UniformQuantizationInfo lhs,
const UniformQuantizationInfo rhs 
)
inline

Check whether two quantization info are not equal.

Parameters
[in]lhsRHS quantization info.
[in]rhsLHS quantization info.
Returns
True if the given quantization info is the same.

Definition at line 207 of file QuantizationInfo.h.

References operator==().

208 {
209  return !(operator==(lhs, rhs));
210 }
bool operator==(const UniformQuantizationInfo &lhs, const UniformQuantizationInfo &rhs)
Check whether two quantization info are equal.

◆ operator!=() [3/3]

bool arm_compute::operator!= ( const Dimensions< T > &  lhs,
const Dimensions< T > &  rhs 
)
inline

Check that given dimensions are not equal.

Parameters
[in]lhsLeft-hand side Dimensions.
[in]rhsRight-hand side Dimensions.
Returns
True if the given dimensions are not equal.

Definition at line 288 of file Dimensions.h.

289 {
290  return !(lhs == rhs);
291 }

◆ operator<<() [1/80]

::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const std::vector< T > &  args 
)

Formatted output of a vector of objects.

Note
: Using the overloaded to_string() instead of overloaded operator<<(), because to_string() functions are overloaded for all types, where two or more of them can use the same operator<<(), ITensor is an example.
Parameters
[out]osOutput stream
[in]argsVector of objects to print
Returns
Modified output stream.

Definition at line 96 of file TypePrinter.h.

References GemmTuner::args, to_string(), and arm_compute::utils::cast::U.

Referenced by operator<<().

97 {
98  const size_t max_print_size = 5U;
99 
100  os << "[";
101  bool first = true;
102  size_t i;
103  for(i = 0; i < args.size(); ++i)
104  {
105  if(i == max_print_size)
106  {
107  break;
108  }
109  if(first)
110  {
111  first = false;
112  }
113  else
114  {
115  os << ", ";
116  }
117  os << to_string(args[i]);
118  }
119  if(i < args.size())
120  {
121  os << ", ...";
122  }
123  os << "]";
124  return os;
125 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [2/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
experimental::PostOpType  post_op_type 
)

Formmated output of the experimental::PostOpType type.

Parameters
[out]osOutput stream.
[in]post_op_typeType to output.
Returns
Modified output stream.

Definition at line 151 of file TypePrinter.h.

References arm_compute::experimental::Activation, ARM_COMPUTE_ERROR, arm_compute::experimental::Eltwise_Add, and arm_compute::experimental::Eltwise_PRelu.

152 {
153  os << "type=";
154  switch(post_op_type)
155  {
157  {
158  os << "Activation";
159  break;
160  }
161  case experimental::PostOpType::Eltwise_Add:
162  {
163  os << "Eltwise_Add";
164  break;
165  }
166  case experimental::PostOpType::Eltwise_PRelu:
167  {
168  os << "Eltwise_PRelu";
169  break;
170  }
171  default:
172  {
173  ARM_COMPUTE_ERROR("Unsupported PostOpType");
174  break;
175  }
176  }
177  return os;
178 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
arm_compute::ActivationLayerInfo::ActivationFunction Activation
Constant TensorID specifying an equivalent of null tensor.
Definition: Types.h:73

◆ operator<<() [3/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const experimental::IPostOp< T > &  post_op 
)

Formatted output of the experimental::IPostOp type.

Parameters
[out]osOutput stream.
[in]post_opType to output.
Returns
Modified output stream.

Definition at line 199 of file TypePrinter.h.

References arm_compute::experimental::Activation, ARM_COMPUTE_ERROR, arm_compute::experimental::Eltwise_Add, and arm_compute::experimental::Eltwise_PRelu.

200 {
201  os << "<";
202  os << post_op.type() << ",";
203  os << "prev_dst_pos=" << post_op.prev_dst_pos() << ",";
204  switch(post_op.type())
205  {
207  {
208  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpAct<T> *>(&post_op);
209  os << "act_info=" << &(_post_op->_act_info);
210  break;
211  }
212  case experimental::PostOpType::Eltwise_Add:
213  {
214  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwiseAdd<T> *>(&post_op);
215  os << "convert_policy=" << _post_op->_policy;
216  break;
217  }
218  case experimental::PostOpType::Eltwise_PRelu:
219  {
220  const auto _post_op = utils::cast::polymorphic_downcast<const experimental::PostOpEltwisePRelu<T> *>(&post_op);
221  os << "convert_policy=" << _post_op->_policy;
222  break;
223  }
224  default:
225  {
226  ARM_COMPUTE_ERROR("Unsupported PostOpType");
227  break;
228  }
229  }
230  os << ">";
231  return os;
232 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
arm_compute::ActivationLayerInfo::ActivationFunction Activation
Constant TensorID specifying an equivalent of null tensor.
Definition: Types.h:73

◆ operator<<() [4/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const experimental::PostOpList< T > &  post_ops 
)

Formatted output of the experimental::PostOpList type.

Parameters
[out]osOutput stream.
[in]post_opsType to output.
Returns
Modified output stream.

Definition at line 254 of file TypePrinter.h.

References arm_compute::test::validation::post_ops.

255 {
256  os << "[";
257  for(const auto &post_op : post_ops.get_list())
258  {
259  os << *post_op << ",";
260  }
261  os << "]";
262  return os;
263 }
experimental::PostOpList< ITensorInfo * > post_ops

◆ operator<<() [5/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Dimensions< T > &  dimensions 
)

Formatted output of the Dimensions type.

Parameters
[out]osOutput stream.
[in]dimensionsType to output.
Returns
Modified output stream.

Definition at line 287 of file TypePrinter.h.

288 {
289  if(dimensions.num_dimensions() > 0)
290  {
291  os << dimensions[0];
292 
293  for(unsigned int d = 1; d < dimensions.num_dimensions(); ++d)
294  {
295  os << "," << dimensions[d];
296  }
297  }
298 
299  return os;
300 }

◆ operator<<() [6/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const RoundingPolicy rounding_policy 
)

Formatted output of the RoundingPolicy type.

Parameters
[out]osOutput stream.
[in]rounding_policyType to output.
Returns
Modified output stream.

Definition at line 309 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, TO_NEAREST_EVEN, TO_NEAREST_UP, and TO_ZERO.

310 {
311  switch(rounding_policy)
312  {
313  case RoundingPolicy::TO_ZERO:
314  os << "TO_ZERO";
315  break;
316  case RoundingPolicy::TO_NEAREST_UP:
317  os << "TO_NEAREST_UP";
318  break;
319  case RoundingPolicy::TO_NEAREST_EVEN:
320  os << "TO_NEAREST_EVEN";
321  break;
322  default:
323  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
324  }
325 
326  return os;
327 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [7/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const WeightsInfo weights_info 
)

Formatted output of the WeightsInfo type.

Parameters
[out]osOutput stream.
[in]weights_infoType to output.
Returns
Modified output stream.

Definition at line 336 of file TypePrinter.h.

References WeightsInfo::are_reshaped(), WeightsInfo::kernel_size(), and WeightsInfo::num_kernels().

337 {
338  os << weights_info.are_reshaped() << ";";
339  os << weights_info.num_kernels() << ";" << weights_info.kernel_size().first << "," << weights_info.kernel_size().second;
340 
341  return os;
342 }

◆ operator<<() [8/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ROIPoolingLayerInfo pool_info 
)

Formatted output of the ROIPoolingInfo type.

Parameters
[out]osOutput stream.
[in]pool_infoType to output.
Returns
Modified output stream.

Definition at line 351 of file TypePrinter.h.

References ROIPoolingLayerInfo::pooled_height(), ROIPoolingLayerInfo::pooled_width(), and ROIPoolingLayerInfo::spatial_scale().

352 {
353  os << pool_info.pooled_width() << "x" << pool_info.pooled_height() << "~" << pool_info.spatial_scale();
354  return os;
355 }

◆ operator<<() [9/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMKernelInfo gemm_info 
)

Formatted output of the GEMMKernelInfo type.

Parameters
[out]osOutput stream.
[in]gemm_infoType to output.
Returns
Modified output stream.

Definition at line 377 of file TypePrinter.h.

References GEMMKernelInfo::a_offset, GEMMKernelInfo::b_offset, GEMMKernelInfo::broadcast_bias, GEMMKernelInfo::depth_output_gemm3d, GEMMKernelInfo::fp_mixed_precision, GEMMKernelInfo::k, GEMMKernelInfo::m, GEMMKernelInfo::mult_interleave4x4_height, GEMMKernelInfo::mult_transpose1xW_width, GEMMKernelInfo::n, GEMMKernelInfo::post_ops, and GEMMKernelInfo::reinterpret_input_as_3d.

378 {
379  os << "( m=" << gemm_info.m;
380  os << " n=" << gemm_info.n;
381  os << " k=" << gemm_info.k;
382  os << " depth_output_gemm3d=" << gemm_info.depth_output_gemm3d;
383  os << " reinterpret_input_as_3d=" << gemm_info.reinterpret_input_as_3d;
384  os << " broadcast_bias=" << gemm_info.broadcast_bias;
385  os << " fp_mixed_precision=" << gemm_info.fp_mixed_precision;
386  os << " mult_transpose1xW_width=" << gemm_info.mult_transpose1xW_width;
387  os << " mult_interleave4x4_height=" << gemm_info.mult_interleave4x4_height;
388  os << " a_offset=" << gemm_info.a_offset;
389  os << " b_offset=" << gemm_info.b_offset;
390  os << "post_ops=" << gemm_info.post_ops;
391  os << ")";
392  return os;
393 }

◆ operator<<() [10/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMLHSMatrixInfo gemm_info 
)

Formatted output of the GEMMLHSMatrixInfo type.

Parameters
[out]osOutput stream.
[in]gemm_infoType to output.
Returns
Modified output stream.

Definition at line 402 of file TypePrinter.h.

References GEMMLHSMatrixInfo::interleave, GEMMLHSMatrixInfo::k0, GEMMLHSMatrixInfo::m0, GEMMLHSMatrixInfo::transpose, and GEMMLHSMatrixInfo::v0.

403 {
404  os << "( m0=" << (unsigned int)gemm_info.m0 << " k0=" << gemm_info.k0 << " v0=" << gemm_info.v0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << "})";
405  return os;
406 }

◆ operator<<() [11/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMRHSMatrixInfo gemm_info 
)

Formatted output of the GEMMRHSMatrixInfo type.

Parameters
[out]osOutput stream.
[in]gemm_infoType to output.
Returns
Modified output stream.

Definition at line 415 of file TypePrinter.h.

References GEMMRHSMatrixInfo::export_to_cl_image, GEMMRHSMatrixInfo::h0, GEMMRHSMatrixInfo::interleave, GEMMRHSMatrixInfo::k0, GEMMRHSMatrixInfo::n0, and GEMMRHSMatrixInfo::transpose.

416 {
417  os << "( n0=" << (unsigned int)gemm_info.n0 << " k0=" << gemm_info.k0 << " h0=" << gemm_info.h0 << " trans=" << gemm_info.transpose << " inter=" << gemm_info.interleave << " exp_img=" <<
418  gemm_info.export_to_cl_image << "})";
419  return os;
420 }

◆ operator<<() [12/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const BoundingBoxTransformInfo bbox_info 
)

Formatted output of the BoundingBoxTransformInfo type.

Parameters
[out]osOutput stream.
[in]bbox_infoType to output.
Returns
Modified output stream.

Definition at line 468 of file TypePrinter.h.

References BoundingBoxTransformInfo::img_height(), BoundingBoxTransformInfo::img_width(), operator<<(), BoundingBoxTransformInfo::scale(), caffe_mnist_image_extractor::str, and BoundingBoxTransformInfo::weights().

469 {
470  auto weights = bbox_info.weights();
471  os << "(" << bbox_info.img_width() << "x" << bbox_info.img_height() << ")~" << bbox_info.scale() << "(weights={" << weights[0] << ", " << weights[1] << ", " << weights[2] << ", " << weights[3] <<
472  "})";
473  return os;
474 }

◆ operator<<() [13/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ComputeAnchorsInfo anchors_info 
)

Formatted output of the ComputeAnchorsInfo type.

Parameters
[out]osOutput stream.
[in]anchors_infoType to output.
Returns
Modified output stream.

Definition at line 506 of file TypePrinter.h.

References ComputeAnchorsInfo::feat_height(), ComputeAnchorsInfo::feat_width(), and ComputeAnchorsInfo::spatial_scale().

507 {
508  os << "(" << anchors_info.feat_width() << "x" << anchors_info.feat_height() << ")~" << anchors_info.spatial_scale();
509  return os;
510 }

◆ operator<<() [14/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GenerateProposalsInfo proposals_info 
)

Formatted output of the GenerateProposalsInfo type.

Parameters
[out]osOutput stream.
[in]proposals_infoType to output.
Returns
Modified output stream.

Definition at line 532 of file TypePrinter.h.

References GenerateProposalsInfo::im_height(), GenerateProposalsInfo::im_scale(), and GenerateProposalsInfo::im_width().

533 {
534  os << "(" << proposals_info.im_width() << "x" << proposals_info.im_height() << ")~" << proposals_info.im_scale();
535  return os;
536 }

◆ operator<<() [15/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const QuantizationInfo qinfo 
)

Formatted output of the QuantizationInfo type.

Parameters
[out]osOutput stream.
[in]qinfoType to output.
Returns
Modified output stream.

Definition at line 558 of file TypePrinter.h.

References UniformQuantizationInfo::offset, UniformQuantizationInfo::scale, and QuantizationInfo::uniform().

559 {
560  const UniformQuantizationInfo uqinfo = qinfo.uniform();
561  os << "Scale:" << uqinfo.scale << "~";
562  os << "Offset:" << uqinfo.offset;
563  return os;
564 }
UniformQuantizationInfo uniform() const
Return per layer quantization info.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ operator<<() [16/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ActivationLayerInfo::ActivationFunction act_function 
)

Formatted output of the activation function type.

Parameters
[out]osOutput stream.
[in]act_functionType to output.
Returns
Modified output stream.

Definition at line 586 of file TypePrinter.h.

References ActivationLayerInfo::ABS, ARM_COMPUTE_ERROR, ActivationLayerInfo::BOUNDED_RELU, ActivationLayerInfo::ELU, ActivationLayerInfo::GELU, ActivationLayerInfo::HARD_SWISH, ActivationLayerInfo::IDENTITY, ActivationLayerInfo::LEAKY_RELU, ActivationLayerInfo::LINEAR, ActivationLayerInfo::LOGISTIC, ActivationLayerInfo::LU_BOUNDED_RELU, ActivationLayerInfo::RELU, ActivationLayerInfo::SOFT_RELU, ActivationLayerInfo::SQRT, ActivationLayerInfo::SQUARE, ActivationLayerInfo::SWISH, and ActivationLayerInfo::TANH.

587 {
588  switch(act_function)
589  {
590  case ActivationLayerInfo::ActivationFunction::ABS:
591  os << "ABS";
592  break;
593  case ActivationLayerInfo::ActivationFunction::LINEAR:
594  os << "LINEAR";
595  break;
596  case ActivationLayerInfo::ActivationFunction::LOGISTIC:
597  os << "LOGISTIC";
598  break;
599  case ActivationLayerInfo::ActivationFunction::RELU:
600  os << "RELU";
601  break;
602  case ActivationLayerInfo::ActivationFunction::BOUNDED_RELU:
603  os << "BOUNDED_RELU";
604  break;
605  case ActivationLayerInfo::ActivationFunction::LEAKY_RELU:
606  os << "LEAKY_RELU";
607  break;
608  case ActivationLayerInfo::ActivationFunction::SOFT_RELU:
609  os << "SOFT_RELU";
610  break;
611  case ActivationLayerInfo::ActivationFunction::SQRT:
612  os << "SQRT";
613  break;
614  case ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU:
615  os << "LU_BOUNDED_RELU";
616  break;
617  case ActivationLayerInfo::ActivationFunction::ELU:
618  os << "ELU";
619  break;
620  case ActivationLayerInfo::ActivationFunction::SQUARE:
621  os << "SQUARE";
622  break;
623  case ActivationLayerInfo::ActivationFunction::TANH:
624  os << "TANH";
625  break;
626  case ActivationLayerInfo::ActivationFunction::IDENTITY:
627  os << "IDENTITY";
628  break;
629  case ActivationLayerInfo::ActivationFunction::HARD_SWISH:
630  os << "HARD_SWISH";
631  break;
632  case ActivationLayerInfo::ActivationFunction::SWISH:
633  os << "SWISH";
634  break;
635  case ActivationLayerInfo::ActivationFunction::GELU:
636  os << "GELU";
637  break;
638 
639  default:
640  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
641  }
642 
643  return os;
644 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [17/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ActivationLayerInfo info 
)

Formatted output of the activation function info.

Parameters
[out]osOutput stream.
[in]infoActivationLayerInfo to output.
Returns
Formatted string.

Definition at line 669 of file TypePrinter.h.

References ActivationLayerInfo::a(), ActivationLayerInfo::activation(), ActivationLayerInfo::b(), and ActivationLayerInfo::enabled().

670 {
671  if(info != nullptr)
672  {
673  if(info->enabled())
674  {
675  os << info->activation();
676  os << "(";
677  os << "VAL_A=" << info->a() << ",";
678  os << "VAL_B=" << info->b();
679  os << ")";
680  }
681  else
682  {
683  os << "disabled";
684  }
685  }
686  else
687  {
688  os << "nullptr";
689  }
690  return os;
691 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [18/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const NormType norm_type 
)

Formatted output of the NormType type.

Parameters
[out]osOutput stream.
[in]norm_typeType to output.
Returns
Modified output stream.

Definition at line 713 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CROSS_MAP, IN_MAP_1D, and IN_MAP_2D.

714 {
715  switch(norm_type)
716  {
717  case NormType::CROSS_MAP:
718  os << "CROSS_MAP";
719  break;
720  case NormType::IN_MAP_1D:
721  os << "IN_MAP_1D";
722  break;
723  case NormType::IN_MAP_2D:
724  os << "IN_MAP_2D";
725  break;
726  default:
727  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
728  }
729 
730  return os;
731 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [19/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const NormalizationLayerInfo info 
)

Formatted output of NormalizationLayerInfo.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 753 of file TypePrinter.h.

References NormalizationLayerInfo::norm_size(), and NormalizationLayerInfo::type().

754 {
755  os << info.type() << ":NormSize=" << info.norm_size();
756  return os;
757 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [20/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PoolingType pool_type 
)

Formatted output of the PoolingType type.

Parameters
[out]osOutput stream.
[in]pool_typeType to output.
Returns
Modified output stream.

Definition at line 766 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, AVG, L2, and MAX.

767 {
768  switch(pool_type)
769  {
770  case PoolingType::AVG:
771  os << "AVG";
772  break;
773  case PoolingType::MAX:
774  os << "MAX";
775  break;
776  case PoolingType::L2:
777  os << "L2";
778  break;
779  default:
780  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
781  }
782 
783  return os;
784 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define MAX(x, y)

◆ operator<<() [21/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PoolingLayerInfo info 
)

Formatted output of PoolingLayerInfo.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 793 of file TypePrinter.h.

References PoolingLayerInfo::pool_type.

794 {
795  os << info.pool_type;
796 
797  return os;
798 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [22/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DataLayout data_layout 
)

[Print DataLayout type]

Formatted output of the DataLayout type.

Parameters
[out]osOutput stream.
[in]data_layoutType to output.
Returns
Modified output stream.

Definition at line 821 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, NCDHW, NCHW, NDHWC, NHWC, and UNKNOWN.

822 {
823  switch(data_layout)
824  {
825  case DataLayout::UNKNOWN:
826  os << "UNKNOWN";
827  break;
828  case DataLayout::NHWC:
829  os << "NHWC";
830  break;
831  case DataLayout::NCHW:
832  os << "NCHW";
833  break;
834  case DataLayout::NDHWC:
835  os << "NDHWC";
836  break;
837  case DataLayout::NCDHW:
838  os << "NCDHW";
839  break;
840  default:
841  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
842  }
843 
844  return os;
845 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [23/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DataLayoutDimension data_layout_dim 
)

[Print DataLayout type]

Formatted output of the DataLayoutDimension type.

Parameters
[out]osOutput stream.
[in]data_layout_dimData layout dimension to print.
Returns
Modified output stream.

Definition at line 868 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, BATCHES, CHANNEL, DEPTH, HEIGHT, and WIDTH.

869 {
870  switch(data_layout_dim)
871  {
872  case DataLayoutDimension::WIDTH:
873  os << "WIDTH";
874  break;
875  case DataLayoutDimension::HEIGHT:
876  os << "HEIGHT";
877  break;
878  case DataLayoutDimension::CHANNEL:
879  os << "CHANNEL";
880  break;
881  case DataLayoutDimension::DEPTH:
882  os << "DEPTH";
883  break;
884  case DataLayoutDimension::BATCHES:
885  os << "BATCHES";
886  break;
887  default:
888  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
889  }
890  return os;
891 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [24/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DataType data_type 
)

Formatted output of the DataType type.

Parameters
[out]osOutput stream.
[in]data_typeType to output.
Returns
Modified output stream.

Definition at line 900 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, F64, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, SIZET, U16, U32, U64, U8, and UNKNOWN.

901 {
902  switch(data_type)
903  {
904  case DataType::UNKNOWN:
905  os << "UNKNOWN";
906  break;
907  case DataType::U8:
908  os << "U8";
909  break;
910  case DataType::QSYMM8:
911  os << "QSYMM8";
912  break;
913  case DataType::QASYMM8:
914  os << "QASYMM8";
915  break;
916  case DataType::QASYMM8_SIGNED:
917  os << "QASYMM8_SIGNED";
918  break;
919  case DataType::QSYMM8_PER_CHANNEL:
920  os << "QSYMM8_PER_CHANNEL";
921  break;
922  case DataType::S8:
923  os << "S8";
924  break;
925  case DataType::U16:
926  os << "U16";
927  break;
928  case DataType::S16:
929  os << "S16";
930  break;
931  case DataType::QSYMM16:
932  os << "QSYMM16";
933  break;
934  case DataType::QASYMM16:
935  os << "QASYMM16";
936  break;
937  case DataType::U32:
938  os << "U32";
939  break;
940  case DataType::S32:
941  os << "S32";
942  break;
943  case DataType::U64:
944  os << "U64";
945  break;
946  case DataType::S64:
947  os << "S64";
948  break;
949  case DataType::BFLOAT16:
950  os << "BFLOAT16";
951  break;
952  case DataType::F16:
953  os << "F16";
954  break;
955  case DataType::F32:
956  os << "F32";
957  break;
958  case DataType::F64:
959  os << "F64";
960  break;
961  case DataType::SIZET:
962  os << "SIZET";
963  break;
964  default:
965  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
966  }
967 
968  return os;
969 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [25/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Format format 
)

Formatted output of the Format type.

Parameters
[out]osOutput stream.
[in]formatType to output.
Returns
Modified output stream.

Definition at line 991 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UNKNOWN, UV88, UYVY422, YUV444, and YUYV422.

992 {
993  switch(format)
994  {
995  case Format::UNKNOWN:
996  os << "UNKNOWN";
997  break;
998  case Format::U8:
999  os << "U8";
1000  break;
1001  case Format::S16:
1002  os << "S16";
1003  break;
1004  case Format::U16:
1005  os << "U16";
1006  break;
1007  case Format::S32:
1008  os << "S32";
1009  break;
1010  case Format::U32:
1011  os << "U32";
1012  break;
1013  case Format::F16:
1014  os << "F16";
1015  break;
1016  case Format::F32:
1017  os << "F32";
1018  break;
1019  case Format::UV88:
1020  os << "UV88";
1021  break;
1022  case Format::RGB888:
1023  os << "RGB888";
1024  break;
1025  case Format::RGBA8888:
1026  os << "RGBA8888";
1027  break;
1028  case Format::YUV444:
1029  os << "YUV444";
1030  break;
1031  case Format::YUYV422:
1032  os << "YUYV422";
1033  break;
1034  case Format::NV12:
1035  os << "NV12";
1036  break;
1037  case Format::NV21:
1038  os << "NV21";
1039  break;
1040  case Format::IYUV:
1041  os << "IYUV";
1042  break;
1043  case Format::UYVY422:
1044  os << "UYVY422";
1045  break;
1046  default:
1047  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1048  }
1049 
1050  return os;
1051 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [26/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Channel channel 
)

Formatted output of the Channel type.

Parameters
[out]osOutput stream.
[in]channelType to output.
Returns
Modified output stream.

Definition at line 1073 of file TypePrinter.h.

References A, ARM_COMPUTE_ERROR, B, C0, C1, C2, C3, G, R, U, UNKNOWN, V, and Y.

1074 {
1075  switch(channel)
1076  {
1077  case Channel::UNKNOWN:
1078  os << "UNKNOWN";
1079  break;
1080  case Channel::C0:
1081  os << "C0";
1082  break;
1083  case Channel::C1:
1084  os << "C1";
1085  break;
1086  case Channel::C2:
1087  os << "C2";
1088  break;
1089  case Channel::C3:
1090  os << "C3";
1091  break;
1092  case Channel::R:
1093  os << "R";
1094  break;
1095  case Channel::G:
1096  os << "G";
1097  break;
1098  case Channel::B:
1099  os << "B";
1100  break;
1101  case Channel::A:
1102  os << "A";
1103  break;
1104  case Channel::Y:
1105  os << "Y";
1106  break;
1107  case Channel::U:
1108  os << "U";
1109  break;
1110  case Channel::V:
1111  os << "V";
1112  break;
1113  default:
1114  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1115  }
1116 
1117  return os;
1118 }
Unknown CL kernel type.
Definition: CLTypes.h:82
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [27/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const BorderMode mode 
)

Formatted output of the BorderMode type.

Parameters
[out]osOutput stream.
[in]modeType to output.
Returns
Modified output stream.

Definition at line 1140 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CONSTANT, REPLICATE, and UNDEFINED.

1141 {
1142  switch(mode)
1143  {
1144  case BorderMode::UNDEFINED:
1145  os << "UNDEFINED";
1146  break;
1147  case BorderMode::CONSTANT:
1148  os << "CONSTANT";
1149  break;
1150  case BorderMode::REPLICATE:
1151  os << "REPLICATE";
1152  break;
1153  default:
1154  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1155  }
1156 
1157  return os;
1158 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [28/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const BorderSize border 
)

Formatted output of the BorderSize type.

Parameters
[out]osOutput stream.
[in]borderType to output.
Returns
Modified output stream.

Definition at line 1167 of file TypePrinter.h.

References BorderSize::bottom, BorderSize::left, BorderSize::right, and BorderSize::top.

1168 {
1169  os << border.top << ","
1170  << border.right << ","
1171  << border.bottom << ","
1172  << border.left;
1173 
1174  return os;
1175 }

◆ operator<<() [29/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PaddingList padding 
)

Formatted output of the PaddingList type.

Parameters
[out]osOutput stream.
[in]paddingType to output.
Returns
Modified output stream.

Definition at line 1184 of file TypePrinter.h.

1185 {
1186  os << "{";
1187  for(auto const &p : padding)
1188  {
1189  os << "{" << p.first << "," << p.second << "}";
1190  }
1191  os << "}";
1192  return os;
1193 }

◆ operator<<() [30/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Multiples multiples 
)

Formatted output of the Multiples type.

Parameters
[out]osOutput stream.
[in]multiplesType to output.
Returns
Modified output stream.

Definition at line 1202 of file TypePrinter.h.

1203 {
1204  os << "(";
1205  for(size_t i = 0; i < multiples.size() - 1; i++)
1206  {
1207  os << multiples[i] << ", ";
1208  }
1209  os << multiples.back() << ")";
1210  return os;
1211 }

◆ operator<<() [31/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const InterpolationPolicy policy 
)

Formatted output of the InterpolationPolicy type.

Parameters
[out]osOutput stream.
[in]policyType to output.
Returns
Modified output stream.

Definition at line 1220 of file TypePrinter.h.

References AREA, ARM_COMPUTE_ERROR, BILINEAR, and NEAREST_NEIGHBOR.

1221 {
1222  switch(policy)
1223  {
1224  case InterpolationPolicy::NEAREST_NEIGHBOR:
1225  os << "NEAREST_NEIGHBOR";
1226  break;
1227  case InterpolationPolicy::BILINEAR:
1228  os << "BILINEAR";
1229  break;
1230  case InterpolationPolicy::AREA:
1231  os << "AREA";
1232  break;
1233  default:
1234  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1235  }
1236 
1237  return os;
1238 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [32/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const SamplingPolicy policy 
)

Formatted output of the SamplingPolicy type.

Parameters
[out]osOutput stream.
[in]policyType to output.
Returns
Modified output stream.

Definition at line 1247 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CENTER, and TOP_LEFT.

1248 {
1249  switch(policy)
1250  {
1251  case SamplingPolicy::CENTER:
1252  os << "CENTER";
1253  break;
1254  case SamplingPolicy::TOP_LEFT:
1255  os << "TOP_LEFT";
1256  break;
1257  default:
1258  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1259  }
1260 
1261  return os;
1262 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [33/80]

inline ::std::ostream& arm_compute::operator<< ( std::ostream &  os,
const ITensorInfo info 
)

Formatted output of the ITensorInfo type.

Parameters
[out]osOutput stream.
[in]infoTensor information.
Returns
Modified output stream.

Definition at line 1271 of file TypePrinter.h.

References ITensorInfo::data_layout(), arm_compute::test::validation::data_layout, arm_compute::test::validation::data_type, ITensorInfo::data_type(), is_data_type_quantized(), QuantizationInfo::offset(), arm_compute::test::validation::qinfo, ITensorInfo::quantization_info(), QuantizationInfo::scale(), string_from_data_layout(), string_from_data_type(), and ITensorInfo::tensor_shape().

1272 {
1273  const DataType data_type = info->data_type();
1275 
1276  os << "Shape=" << info->tensor_shape() << ","
1277  << "DataLayout=" << string_from_data_layout(data_layout) << ","
1278  << "DataType=" << string_from_data_type(data_type);
1279 
1280  if(is_data_type_quantized(data_type))
1281  {
1282  const QuantizationInfo qinfo = info->quantization_info();
1283  const auto scales = qinfo.scale();
1284  const auto offsets = qinfo.offset();
1285 
1286  os << ", QuantizationInfo={"
1287  << "scales.size=" << scales.size()
1288  << ", scale(s)=" << scales << ", ";
1289 
1290  os << "offsets.size=" << offsets.size()
1291  << ", offset(s)=" << offsets << "}";
1292  }
1293  return os;
1294 }
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
Definition: Utils.h:1030
DataType
Definition: Acl.hpp:485
const std::string & string_from_data_type(DataType dt)
Convert a data type identity into a string.
Definition: Utils.cpp:135
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
const std::string & string_from_data_layout(DataLayout dl)
Convert a data layout identity into a string.
Definition: Utils.cpp:123
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155
DataLayout data_layout
Data layout to use.
DataLayout
[DataLayout enum definition]
Definition: Types.h:113

◆ operator<<() [34/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const TensorInfo info 
)

Formatted output of the const TensorInfo& type.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 1303 of file TypePrinter.h.

References arm_compute::test::validation::info.

1304 {
1305  os << &info;
1306  return os;
1307 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [35/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMReshapeInfo info 
)

Formatted output of the GEMMReshapeInfo type.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 1497 of file TypePrinter.h.

References GEMMReshapeInfo::k(), GEMMReshapeInfo::m(), GEMMReshapeInfo::mult_interleave4x4_height(), GEMMReshapeInfo::mult_transpose1xW_width(), and GEMMReshapeInfo::n().

1498 {
1499  os << "{m=" << info.m() << ",";
1500  os << "n=" << info.n() << ",";
1501  os << "k=" << info.k() << ",";
1502  os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ",";
1503  os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height();
1504  os << "}";
1505 
1506  return os;
1507 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [36/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMInfo info 
)

Formatted output of the GEMMInfo type.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 1516 of file TypePrinter.h.

References GEMMInfo::broadcast_bias(), GEMMInfo::depth_output_gemm3d(), GEMMInfo::fp_mixed_precision(), GEMMInfo::is_a_reshaped(), GEMMInfo::is_b_reshaped(), GEMMInfo::post_ops(), GEMMInfo::pretranspose_B(), GEMMInfo::reinterpret_input_as_3d(), GEMMInfo::reshape_b_only_on_first_run(), and GEMMInfo::retain_internal_weights().

1517 {
1518  os << "{is_a_reshaped=" << info.is_a_reshaped() << ",";
1519  os << "is_b_reshaped=" << info.is_b_reshaped() << ",";
1520  os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ",";
1521  os << "depth_output_gemm3d=" << info.depth_output_gemm3d() << ",";
1522  os << "reinterpret_input_as_3d=" << info.reinterpret_input_as_3d() << ",";
1523  os << "retain_internal_weights=" << info.retain_internal_weights() << ",";
1524  os << "fp_mixed_precision=" << info.fp_mixed_precision() << ",";
1525  os << "broadcast_bias=" << info.broadcast_bias() << ",";
1526  os << "pretranspose_B=" << info.pretranspose_B() << ",";
1527  os << "post_ops=" << info.post_ops() << "}";
1528 
1529  return os;
1530 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [37/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Window::Dimension dim 
)

Formatted output of the Window::Dimension type.

Parameters
[out]osOutput stream.
[in]dimType to output.
Returns
Modified output stream.

Definition at line 1539 of file TypePrinter.h.

References Window::Dimension::end(), Window::Dimension::start(), and Window::Dimension::step().

1540 {
1541  os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}";
1542 
1543  return os;
1544 }

◆ operator<<() [38/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Window win 
)

Formatted output of the Window type.

Parameters
[out]osOutput stream.
[in]winType to output.
Returns
Modified output stream.

Definition at line 1552 of file TypePrinter.h.

References Dimensions< int >::num_max_dimensions.

1553 {
1554  os << "{";
1555  for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++)
1556  {
1557  if(i > 0)
1558  {
1559  os << ", ";
1560  }
1561  os << win[i];
1562  }
1563  os << "}";
1564 
1565  return os;
1566 }

◆ operator<<() [39/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Rectangle rect 
)

Formatted output of the Rectangle type.

Parameters
[out]osOutput stream.
[in]rectType to output.
Returns
Modified output stream.

Definition at line 1657 of file TypePrinter.h.

References Rectangle::height, Rectangle::width, Rectangle::x, and Rectangle::y.

1658 {
1659  os << rect.width << "x" << rect.height;
1660  os << "+" << rect.x << "+" << rect.y;
1661 
1662  return os;
1663 }

◆ operator<<() [40/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PaddingMode mode 
)

Formatted output of the PaddingMode type.

Parameters
[out]osOutput stream.
[in]modeType to output.
Returns
Modified output stream.

Definition at line 1672 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CONSTANT, REFLECT, and SYMMETRIC.

1673 {
1674  switch(mode)
1675  {
1676  case PaddingMode::CONSTANT:
1677  os << "CONSTANT";
1678  break;
1679  case PaddingMode::REFLECT:
1680  os << "REFLECT";
1681  break;
1682  case PaddingMode::SYMMETRIC:
1683  os << "SYMMETRIC";
1684  break;
1685  default:
1686  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1687  }
1688 
1689  return os;
1690 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [41/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PadStrideInfo pad_stride_info 
)

Formatted output of the PadStrideInfo type.

Parameters
[out]osOutput stream.
[in]pad_stride_infoType to output.
Returns
Modified output stream.

Definition at line 1712 of file TypePrinter.h.

References PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), and PadStrideInfo::stride().

1713 {
1714  os << pad_stride_info.stride().first << "," << pad_stride_info.stride().second;
1715  os << ";";
1716  os << pad_stride_info.pad_left() << "," << pad_stride_info.pad_right() << ","
1717  << pad_stride_info.pad_top() << "," << pad_stride_info.pad_bottom();
1718 
1719  return os;
1720 }

◆ operator<<() [42/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ConvertPolicy policy 
)

Formatted output of the ConvertPolicy type.

Parameters
[out]osOutput stream.
[in]policyType to output.
Returns
Modified output stream.

Definition at line 1820 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, SATURATE, and WRAP.

1821 {
1822  switch(policy)
1823  {
1824  case ConvertPolicy::WRAP:
1825  os << "WRAP";
1826  break;
1827  case ConvertPolicy::SATURATE:
1828  os << "SATURATE";
1829  break;
1830  default:
1831  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1832  }
1833 
1834  return os;
1835 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [43/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ArithmeticOperation op 
)

Formatted output of the ArithmeticOperation type.

Parameters
[out]osOutput stream.
[in]opOperation to output.
Returns
Modified output stream.

Definition at line 1851 of file TypePrinter.h.

References ADD, ARM_COMPUTE_ERROR, DIV, MAX, MIN, POWER, SQUARED_DIFF, and SUB.

1852 {
1853  switch(op)
1854  {
1856  os << "ADD";
1857  break;
1859  os << "SUB";
1860  break;
1862  os << "DIV";
1863  break;
1865  os << "MAX";
1866  break;
1868  os << "MIN";
1869  break;
1871  os << "SQUARED_DIFF";
1872  break;
1873  case ArithmeticOperation::POWER:
1874  os << "POWER";
1875  break;
1876  default:
1877  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1878  }
1879 
1880  return os;
1881 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define DIV(x, y)
#define MAX(x, y)
#define MIN(x, y)
#define SUB(x, y)
#define ADD(x, y)
#define SQUARED_DIFF(x, y)

◆ operator<<() [44/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ReductionOperation op 
)

Formatted output of the Reduction Operations.

Parameters
[out]osOutput stream.
[in]opType to output.
Returns
Modified output stream.

Definition at line 1903 of file TypePrinter.h.

References ARG_IDX_MAX, ARG_IDX_MIN, ARM_COMPUTE_ERROR, MAX, MEAN_SUM, MIN, PROD, SUM, and SUM_SQUARE.

1904 {
1905  switch(op)
1906  {
1907  case ReductionOperation::SUM:
1908  os << "SUM";
1909  break;
1910  case ReductionOperation::SUM_SQUARE:
1911  os << "SUM_SQUARE";
1912  break;
1913  case ReductionOperation::MEAN_SUM:
1914  os << "MEAN_SUM";
1915  break;
1916  case ReductionOperation::ARG_IDX_MAX:
1917  os << "ARG_IDX_MAX";
1918  break;
1919  case ReductionOperation::ARG_IDX_MIN:
1920  os << "ARG_IDX_MIN";
1921  break;
1922  case ReductionOperation::PROD:
1923  os << "PROD";
1924  break;
1926  os << "MIN";
1927  break;
1929  os << "MAX";
1930  break;
1931  default:
1932  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1933  }
1934 
1935  return os;
1936 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define MAX(x, y)
#define MIN(x, y)

◆ operator<<() [45/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ComparisonOperation op 
)

Formatted output of the Comparison Operations.

Parameters
[out]osOutput stream.
[in]opType to output.
Returns
Modified output stream.

Definition at line 1958 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, Equal, Greater, GreaterEqual, Less, LessEqual, and NotEqual.

1959 {
1960  switch(op)
1961  {
1962  case ComparisonOperation::Equal:
1963  os << "Equal";
1964  break;
1965  case ComparisonOperation::NotEqual:
1966  os << "NotEqual";
1967  break;
1968  case ComparisonOperation::Greater:
1969  os << "Greater";
1970  break;
1971  case ComparisonOperation::GreaterEqual:
1972  os << "GreaterEqual";
1973  break;
1974  case ComparisonOperation::Less:
1975  os << "Less";
1976  break;
1977  case ComparisonOperation::LessEqual:
1978  os << "LessEqual";
1979  break;
1980  default:
1981  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
1982  }
1983 
1984  return os;
1985 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [46/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ElementWiseUnary op 
)

Formatted output of the Elementwise unary Operations.

Parameters
[out]osOutput stream.
[in]opType to output.
Returns
Modified output stream.

Definition at line 1994 of file TypePrinter.h.

References ABS, ARM_COMPUTE_ERROR, EXP, LOG, LOGICAL_NOT, NEG, ROUND, RSQRT, and SIN.

1995 {
1996  switch(op)
1997  {
1998  case ElementWiseUnary::RSQRT:
1999  os << "RSQRT";
2000  break;
2001  case ElementWiseUnary::EXP:
2002  os << "EXP";
2003  break;
2004  case ElementWiseUnary::NEG:
2005  os << "NEG";
2006  break;
2007  case ElementWiseUnary::LOG:
2008  os << "LOG";
2009  break;
2010  case ElementWiseUnary::SIN:
2011  os << "SIN";
2012  break;
2013  case ElementWiseUnary::ABS:
2014  os << "ABS";
2015  break;
2016  case ElementWiseUnary::ROUND:
2017  os << "ROUND";
2018  break;
2019  case ElementWiseUnary::LOGICAL_NOT:
2020  os << "LOGICAL_NOT";
2021  break;
2022  default:
2023  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2024  }
2025 
2026  return os;
2027 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [47/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Size3D size 
)

Formatted output of the Size3D type.

Parameters
[out]osOutput stream
[in]sizeType to output
Returns
Modified output stream.

Definition at line 2110 of file TypePrinter.h.

References Size3D::depth, Size3D::height, and Size3D::width.

2111 {
2112  os << size.width << "x" << size.height << "x" << size.depth;
2113 
2114  return os;
2115 }

◆ operator<<() [48/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Padding3D padding3d 
)

Formatted output of the Padding3D type.

Parameters
[out]osOutput stream.
[in]padding3dPadding info for 3D spatial dimension shape.
Returns
Modified output stream.

Definition at line 2137 of file TypePrinter.h.

References Padding3D::back, Padding3D::bottom, Padding3D::front, Padding3D::left, Padding3D::right, and Padding3D::top.

2138 {
2139  os << padding3d.left << "," << padding3d.right << ","
2140  << padding3d.top << "," << padding3d.bottom << ","
2141  << padding3d.front << "," << padding3d.back;
2142  return os;
2143 }

◆ operator<<() [49/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DimensionRoundingType rounding_type 
)

Formatted output of the DimensionRoundingType type.

Parameters
[out]osOutput stream.
[in]rounding_typeDimensionRoundingType Dimension rounding type when down-scaling, or compute output shape of pooling(2D or 3D).
Returns
Modified output stream.

Definition at line 2165 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CEIL, and FLOOR.

2166 {
2167  switch(rounding_type)
2168  {
2169  case DimensionRoundingType::CEIL:
2170  os << "CEIL";
2171  break;
2172  case DimensionRoundingType::FLOOR:
2173  os << "FLOOR";
2174  break;
2175  default:
2176  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2177  }
2178  return os;
2179 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [50/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Pooling3dLayerInfo info 
)

Formatted output of the Pooling 3d Layer Info.

Parameters
[out]osOutput stream.
[in]infoPooling 3D layer info to print to output stream.
Returns
Modified output stream.

Definition at line 2188 of file TypePrinter.h.

References Pooling3dLayerInfo::exclude_padding, Pooling3dLayerInfo::fp_mixed_precision, Pooling3dLayerInfo::is_global_pooling, Pooling3dLayerInfo::padding, Pooling3dLayerInfo::pool_size, Pooling3dLayerInfo::pool_type, Pooling3dLayerInfo::round_type, and Pooling3dLayerInfo::stride.

2189 {
2190  os << "{Type=" << info.pool_type << ","
2191  << "IsGlobalPooling=" << info.is_global_pooling;
2192  if(!info.is_global_pooling)
2193  {
2194  os << ","
2195  << "PoolSize=" << info.pool_size << ", "
2196  << "Stride=" << info.stride << ", "
2197  << "Padding=" << info.padding << ", "
2198  << "Exclude Padding=" << info.exclude_padding << ", "
2199  << "fp_mixed_precision=" << info.fp_mixed_precision << ", "
2200  << "DimensionRoundingType=" << info.round_type;
2201  }
2202  os << "}";
2203  return os;
2204 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [51/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Size2D size 
)

Formatted output of the Size2D type.

Parameters
[out]osOutput stream
[in]sizeType to output
Returns
Modified output stream.

Definition at line 2250 of file TypePrinter.h.

References Size2D::height, and Size2D::width.

2251 {
2252  os << size.width << "x" << size.height;
2253 
2254  return os;
2255 }

◆ operator<<() [52/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ConvolutionMethod conv_method 
)

Formatted output of the ConvolutionMethod type.

Parameters
[out]osOutput stream
[in]conv_methodType to output
Returns
Modified output stream.

Definition at line 2277 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, DIRECT, FFT, GEMM, GEMM_CONV2D, and WINOGRAD.

2278 {
2279  switch(conv_method)
2280  {
2282  os << "GEMM";
2283  break;
2285  os << "DIRECT";
2286  break;
2288  os << "WINOGRAD";
2289  break;
2290  case ConvolutionMethod::FFT:
2291  os << "FFT";
2292  break;
2293  case ConvolutionMethod::GEMM_CONV2D:
2294  os << "GEMM_CONV2D";
2295  break;
2296  default:
2297  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2298  }
2299 
2300  return os;
2301 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
Winograd CL kernel type.
Definition: CLTypes.h:88
GEMM CL kernel type.
Definition: CLTypes.h:86
Direct Convolution CL kernel type.
Definition: CLTypes.h:84

◆ operator<<() [53/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GPUTarget gpu_target 
)

Formatted output of the GPUTarget type.

Parameters
[out]osOutput stream
[in]gpu_targetType to output
Returns
Modified output stream.

Definition at line 2323 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, BIFROST, G31, G310, G51, G510, G51BIG, G51LIT, G52, G52LIT, G57, G610, G615, G68, G71, G710, G715, G72, G76, G77, G78, G78AE, GPU_ARCH_MASK, GPU_GENERATION_MASK, MIDGARD, T600, T700, T800, and VALHALL.

2324 {
2325  switch(gpu_target)
2326  {
2327  case GPUTarget::GPU_ARCH_MASK:
2328  os << "GPU_ARCH_MASK";
2329  break;
2330  case GPUTarget::GPU_GENERATION_MASK:
2331  os << "GPU_GENERATION_MASK";
2332  break;
2333  case GPUTarget::MIDGARD:
2334  os << "MIDGARD";
2335  break;
2336  case GPUTarget::BIFROST:
2337  os << "BIFROST";
2338  break;
2339  case GPUTarget::VALHALL:
2340  os << "VALHALL";
2341  break;
2342  case GPUTarget::T600:
2343  os << "T600";
2344  break;
2345  case GPUTarget::T700:
2346  os << "T700";
2347  break;
2348  case GPUTarget::T800:
2349  os << "T800";
2350  break;
2351  case GPUTarget::G71:
2352  os << "G71";
2353  break;
2354  case GPUTarget::G72:
2355  os << "G72";
2356  break;
2357  case GPUTarget::G51:
2358  os << "G51";
2359  break;
2360  case GPUTarget::G51BIG:
2361  os << "G51BIG";
2362  break;
2363  case GPUTarget::G51LIT:
2364  os << "G51LIT";
2365  break;
2366  case GPUTarget::G31:
2367  os << "G31";
2368  break;
2369  case GPUTarget::G76:
2370  os << "G76";
2371  break;
2372  case GPUTarget::G52:
2373  os << "G52";
2374  break;
2375  case GPUTarget::G52LIT:
2376  os << "G52LIT";
2377  break;
2378  case GPUTarget::G77:
2379  os << "G77";
2380  break;
2381  case GPUTarget::G57:
2382  os << "G57";
2383  break;
2384  case GPUTarget::G78:
2385  os << "G78";
2386  break;
2387  case GPUTarget::G68:
2388  os << "G68";
2389  break;
2390  case GPUTarget::G78AE:
2391  os << "G78AE";
2392  break;
2393  case GPUTarget::G710:
2394  os << "G710";
2395  break;
2396  case GPUTarget::G610:
2397  os << "G610";
2398  break;
2399  case GPUTarget::G510:
2400  os << "G510";
2401  break;
2402  case GPUTarget::G310:
2403  os << "G310";
2404  break;
2405  case GPUTarget::G715:
2406  os << "G715";
2407  break;
2408  case GPUTarget::G615:
2409  os << "G615";
2410  break;
2411  default:
2412  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2413  }
2414 
2415  return os;
2416 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [54/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DetectionWindow detection_window 
)

Formatted output of the DetectionWindow type.

Parameters
[out]osOutput stream
[in]detection_windowType to output
Returns
Modified output stream.

Definition at line 2438 of file TypePrinter.h.

References DetectionWindow::height, DetectionWindow::idx_class, DetectionWindow::score, DetectionWindow::width, DetectionWindow::x, and DetectionWindow::y.

2439 {
2440  os << "{x=" << detection_window.x << ","
2441  << "y=" << detection_window.y << ","
2442  << "width=" << detection_window.width << ","
2443  << "height=" << detection_window.height << ","
2444  << "idx_class=" << detection_window.idx_class << ","
2445  << "score=" << detection_window.score << "}";
2446 
2447  return os;
2448 }
ushort idx_class
Index of the class.
Definition: types.h:53
ushort y
Top-left y coordinate.
Definition: types.h:50
float score
Confidence value for the detection window.
Definition: types.h:54
ushort height
Height of the detection window.
Definition: types.h:52
ushort x
Top-left x coordinate.
Definition: types.h:49
ushort width
Width of the detection window.
Definition: types.h:51

◆ operator<<() [55/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DetectionOutputLayerCodeType detection_code 
)

Formatted output of the DetectionOutputLayerCodeType type.

Parameters
[out]osOutput stream
[in]detection_codeType to output
Returns
Modified output stream.

Definition at line 2457 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CENTER_SIZE, CORNER, CORNER_SIZE, and TF_CENTER.

2458 {
2459  switch(detection_code)
2460  {
2461  case DetectionOutputLayerCodeType::CENTER_SIZE:
2462  os << "CENTER_SIZE";
2463  break;
2464  case DetectionOutputLayerCodeType::CORNER:
2465  os << "CORNER";
2466  break;
2467  case DetectionOutputLayerCodeType::CORNER_SIZE:
2468  os << "CORNER_SIZE";
2469  break;
2470  case DetectionOutputLayerCodeType::TF_CENTER:
2471  os << "TF_CENTER";
2472  break;
2473  default:
2474  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2475  }
2476 
2477  return os;
2478 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [56/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DetectionOutputLayerInfo detection_info 
)

Formatted output of the DetectionOutputLayerInfo type.

Parameters
[out]osOutput stream
[in]detection_infoType to output
Returns
Modified output stream.

Definition at line 2499 of file TypePrinter.h.

References DetectionOutputLayerInfo::background_label_id(), DetectionOutputLayerInfo::code_type(), DetectionOutputLayerInfo::confidence_threshold(), DetectionOutputLayerInfo::eta(), DetectionOutputLayerInfo::keep_top_k(), DetectionOutputLayerInfo::nms_threshold(), DetectionOutputLayerInfo::num_classes(), DetectionOutputLayerInfo::num_loc_classes(), DetectionOutputLayerInfo::share_location(), DetectionOutputLayerInfo::top_k(), and DetectionOutputLayerInfo::variance_encoded_in_target().

2500 {
2501  os << "{Classes=" << detection_info.num_classes() << ","
2502  << "ShareLocation=" << detection_info.share_location() << ","
2503  << "CodeType=" << detection_info.code_type() << ","
2504  << "VarianceEncodedInTarget=" << detection_info.variance_encoded_in_target() << ","
2505  << "KeepTopK=" << detection_info.keep_top_k() << ","
2506  << "NMSThreshold=" << detection_info.nms_threshold() << ","
2507  << "Eta=" << detection_info.eta() << ","
2508  << "BackgroundLabelId=" << detection_info.background_label_id() << ","
2509  << "ConfidenceThreshold=" << detection_info.confidence_threshold() << ","
2510  << "TopK=" << detection_info.top_k() << ","
2511  << "NumLocClasses=" << detection_info.num_loc_classes()
2512  << "}";
2513 
2514  return os;
2515 }

◆ operator<<() [57/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const DetectionPostProcessLayerInfo detection_info 
)

Formatted output of the DetectionPostProcessLayerInfo type.

Parameters
[out]osOutput stream
[in]detection_infoType to output
Returns
Modified output stream.

Definition at line 2536 of file TypePrinter.h.

References DetectionPostProcessLayerInfo::detection_per_class(), DetectionPostProcessLayerInfo::iou_threshold(), DetectionPostProcessLayerInfo::max_classes_per_detection(), DetectionPostProcessLayerInfo::max_detections(), DetectionPostProcessLayerInfo::nms_score_threshold(), DetectionPostProcessLayerInfo::num_classes(), DetectionPostProcessLayerInfo::scale_value_h(), DetectionPostProcessLayerInfo::scale_value_w(), DetectionPostProcessLayerInfo::scale_value_x(), DetectionPostProcessLayerInfo::scale_value_y(), and DetectionPostProcessLayerInfo::use_regular_nms().

2537 {
2538  os << "{MaxDetections=" << detection_info.max_detections() << ","
2539  << "MaxClassesPerDetection=" << detection_info.max_classes_per_detection() << ","
2540  << "NmsScoreThreshold=" << detection_info.nms_score_threshold() << ","
2541  << "NmsIouThreshold=" << detection_info.iou_threshold() << ","
2542  << "NumClasses=" << detection_info.num_classes() << ","
2543  << "ScaleValue_y=" << detection_info.scale_value_y() << ","
2544  << "ScaleValue_x=" << detection_info.scale_value_x() << ","
2545  << "ScaleValue_h=" << detection_info.scale_value_h() << ","
2546  << "ScaleValue_w=" << detection_info.scale_value_w() << ","
2547  << "UseRegularNms=" << detection_info.use_regular_nms() << ","
2548  << "DetectionPerClass=" << detection_info.detection_per_class()
2549  << "}";
2550 
2551  return os;
2552 }

◆ operator<<() [58/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PriorBoxLayerInfo info 
)

Formatted output of PriorBoxLayerInfo.

Parameters
[out]osOutput stream.
[in]infoType to output.
Returns
Modified output stream.

Definition at line 2587 of file TypePrinter.h.

References PriorBoxLayerInfo::clip(), PriorBoxLayerInfo::flip(), PriorBoxLayerInfo::img_size(), PriorBoxLayerInfo::max_sizes(), PriorBoxLayerInfo::min_sizes(), PriorBoxLayerInfo::offset(), PriorBoxLayerInfo::steps(), PriorBoxLayerInfo::variances(), Coordinates2D::x, and Coordinates2D::y.

2588 {
2589  os << "Clip:" << info.clip()
2590  << "Flip:" << info.flip()
2591  << "StepX:" << info.steps()[0]
2592  << "StepY:" << info.steps()[1]
2593  << "MinSizes:" << info.min_sizes()
2594  << "MaxSizes:" << info.max_sizes()
2595  << "ImgSizeX:" << info.img_size().x
2596  << "ImgSizeY:" << info.img_size().y
2597  << "Offset:" << info.offset()
2598  << "Variances:" << info.variances();
2599 
2600  return os;
2601 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [59/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const WinogradInfo info 
)

Formatted output of the WinogradInfo type.

Definition at line 2604 of file TypePrinter.h.

References WinogradInfo::convolution_info, WinogradInfo::kernel_size, WinogradInfo::output_data_layout, and WinogradInfo::output_tile_size.

2605 {
2606  os << "{OutputTileSize=" << info.output_tile_size << ","
2607  << "KernelSize=" << info.kernel_size << ","
2608  << "PadStride=" << info.convolution_info << ","
2609  << "OutputDataLayout=" << info.output_data_layout << "}";
2610 
2611  return os;
2612 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [60/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const CLTunerMode val 
)

[Print CLTunerMode type]

Formatted output of the CLTunerMode type.

Parameters
[out]osOutput stream.
[in]valCLTunerMode to output.
Returns
Modified output stream.

Definition at line 2686 of file TypePrinter.h.

References to_string().

2687 {
2688  os << to_string(val);
2689  return os;
2690 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [61/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ConvolutionInfo conv_info 
)

Formatted output of the ConvolutionInfo type.

Parameters
[out]osOutput stream.
[in]conv_infoConvolutionInfo to output.
Returns
Modified output stream.

Definition at line 2699 of file TypePrinter.h.

References ConvolutionInfo::act_info, ConvolutionInfo::depth_multiplier, ConvolutionInfo::dilation, ConvolutionInfo::pad_stride_info, and to_string().

2700 {
2701  os << "{PadStrideInfo=" << conv_info.pad_stride_info << ", "
2702  << "depth_multiplier=" << conv_info.depth_multiplier << ", "
2703  << "act_info=" << to_string(conv_info.act_info) << ", "
2704  << "dilation=" << conv_info.dilation << "}";
2705  return os;
2706 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [62/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const FullyConnectedLayerInfo layer_info 
)

Formatted output of the FullyConnectedLayerInfo type.

Parameters
[out]osOutput stream.
[in]layer_infoFullyConnectedLayerInfo to output.
Returns
Modified output stream.

Definition at line 2728 of file TypePrinter.h.

References FullyConnectedLayerInfo::activation_info, FullyConnectedLayerInfo::are_weights_reshaped, FullyConnectedLayerInfo::fp_mixed_precision, FullyConnectedLayerInfo::retain_internal_weights, to_string(), FullyConnectedLayerInfo::transpose_weights, and FullyConnectedLayerInfo::weights_trained_layout.

2729 {
2730  os << "{activation_info=" << to_string(layer_info.activation_info) << ", "
2731  << "weights_trained_layout=" << layer_info.weights_trained_layout << ", "
2732  << "transpose_weights=" << layer_info.transpose_weights << ", "
2733  << "are_weights_reshaped=" << layer_info.are_weights_reshaped << ", "
2734  << "retain_internal_weights=" << layer_info.retain_internal_weights << ", "
2735  << "constant_weights=" << layer_info.transpose_weights << ", "
2736  << "fp_mixed_precision=" << layer_info.fp_mixed_precision << "}";
2737  return os;
2738 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [63/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMLowpOutputStageType gemm_type 
)

Formatted output of the GEMMLowpOutputStageType type.

Parameters
[out]osOutput stream.
[in]gemm_typeGEMMLowpOutputStageType to output.
Returns
Modified output stream.

Definition at line 2760 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, NONE, QUANTIZE_DOWN, QUANTIZE_DOWN_FIXEDPOINT, and QUANTIZE_DOWN_FLOAT.

2761 {
2762  switch(gemm_type)
2763  {
2764  case GEMMLowpOutputStageType::NONE:
2765  os << "NONE";
2766  break;
2767  case GEMMLowpOutputStageType::QUANTIZE_DOWN:
2768  os << "QUANTIZE_DOWN";
2769  break;
2770  case GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT:
2771  os << "QUANTIZE_DOWN_FIXEDPOINT";
2772  break;
2773  case GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT:
2774  os << "QUANTIZE_DOWN_FLOAT";
2775  break;
2776  default:
2777  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2778  }
2779  return os;
2780 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
GEMMType gemm_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:567

◆ operator<<() [64/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const GEMMLowpOutputStageInfo gemm_info 
)

Formatted output of the GEMMLowpOutputStageInfo type.

Parameters
[out]osOutput stream.
[in]gemm_infoGEMMLowpOutputStageInfo to output.
Returns
Modified output stream.

Definition at line 2802 of file TypePrinter.h.

References GEMMLowpOutputStageInfo::gemmlowp_max_bound, GEMMLowpOutputStageInfo::gemmlowp_min_bound, GEMMLowpOutputStageInfo::gemmlowp_multiplier, GEMMLowpOutputStageInfo::gemmlowp_offset, GEMMLowpOutputStageInfo::gemmlowp_real_multiplier, GEMMLowpOutputStageInfo::gemmlowp_shift, GEMMLowpOutputStageInfo::is_quantized_per_channel, GEMMLowpOutputStageInfo::output_data_type, and GEMMLowpOutputStageInfo::type.

2803 {
2804  os << "{type=" << gemm_info.type << ", "
2805  << "gemlowp_offset=" << gemm_info.gemmlowp_offset << ", "
2806  << "gemmlowp_multiplier=" << gemm_info.gemmlowp_multiplier << ", "
2807  << "gemmlowp_shift=" << gemm_info.gemmlowp_shift << ", "
2808  << "gemmlowp_min_bound=" << gemm_info.gemmlowp_min_bound << ", "
2809  << "gemmlowp_max_bound=" << gemm_info.gemmlowp_max_bound << ", "
2810  << "gemmlowp_multipliers=" << gemm_info.gemmlowp_multiplier << ", "
2811  << "gemmlowp_shifts=" << gemm_info.gemmlowp_shift << ", "
2812  << "gemmlowp_real_multiplier=" << gemm_info.gemmlowp_real_multiplier << ", "
2813  << "is_quantized_per_channel=" << gemm_info.is_quantized_per_channel << ", "
2814  << "output_data_type=" << gemm_info.output_data_type << "}";
2815  return os;
2816 }

◆ operator<<() [65/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Conv2dInfo conv_info 
)

Formatted output of the Conv2dInfo type.

Parameters
[out]osOutput stream.
[in]conv_infoConv2dInfo to output.
Returns
Modified output stream.

Definition at line 2838 of file TypePrinter.h.

References Conv2dInfo::act_info, Conv2dInfo::conv_info, Conv2dInfo::dilation, Conv2dInfo::enable_fast_math, Conv2dInfo::num_groups, Conv2dInfo::post_ops, and to_string().

2839 {
2840  os << "{conv_info=" << conv_info.conv_info << ", "
2841  << "dilation=" << conv_info.dilation << ", "
2842  << "act_info=" << to_string(conv_info.act_info) << ", "
2843  << "enable_fast_math=" << conv_info.enable_fast_math << ", "
2844  << "num_groups=" << conv_info.num_groups << ","
2845  << "post_ops=" << conv_info.post_ops << "}";
2846  return os;
2847 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [66/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const PixelValue pixel_value 
)

Formatted output of the PixelValue type.

Parameters
[out]osOutput stream.
[in]pixel_valuePixelValue to output.
Returns
Modified output stream.

Definition at line 2869 of file TypePrinter.h.

References PixelValue::get().

2870 {
2871  os << "{value.u64=" << pixel_value.get<uint64_t>() << "}";
2872  return os;
2873 }

◆ operator<<() [67/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const ScaleKernelInfo scale_info 
)

Formatted output of the ScaleKernelInfo type.

Parameters
[out]osOutput stream.
[in]scale_infoScaleKernelInfo to output.
Returns
Modified output stream.

Definition at line 2895 of file TypePrinter.h.

References ScaleKernelInfo::align_corners, ScaleKernelInfo::border_mode, ScaleKernelInfo::constant_border_value, ScaleKernelInfo::data_layout, ScaleKernelInfo::interpolation_policy, ScaleKernelInfo::sampling_policy, and ScaleKernelInfo::use_padding.

2896 {
2897  os << "{interpolation_policy=" << scale_info.interpolation_policy << ", "
2898  << "BorderMode=" << scale_info.border_mode << ", "
2899  << "PixelValue=" << scale_info.constant_border_value << ", "
2900  << "SamplingPolicy=" << scale_info.sampling_policy << ", "
2901  << "use_padding=" << scale_info.use_padding << ", "
2902  << "align_corners=" << scale_info.align_corners << ", "
2903  << "data_layout=" << scale_info.data_layout << "}";
2904  return os;
2905 }

◆ operator<<() [68/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const FFTDirection fft_dir 
)

Formatted output of the FFTDirection type.

Parameters
[out]osOutput stream.
[in]fft_dirFFTDirection to output.
Returns
Modified output stream.

Definition at line 2927 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, Forward, and Inverse.

2928 {
2929  switch(fft_dir)
2930  {
2931  case FFTDirection::Forward:
2932  os << "Forward";
2933  break;
2934  case FFTDirection::Inverse:
2935  os << "Inverse";
2936  break;
2937  default:
2938  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
2939  }
2940  return os;
2941 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [69/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const FFT1DInfo fft1d_info 
)

Formatted output of the FFT1DInfo type.

Parameters
[out]osOutput stream.
[in]fft1d_infoFFT1DInfo to output.
Returns
Modified output stream.

Definition at line 2963 of file TypePrinter.h.

References FFT1DInfo::axis, and FFT1DInfo::direction.

2964 {
2965  os << "{axis=" << fft1d_info.axis << ", "
2966  << "direction=" << fft1d_info.direction << "}";
2967  return os;
2968 }

◆ operator<<() [70/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const FFT2DInfo fft2d_info 
)

Formatted output of the FFT2DInfo type.

Parameters
[out]osOutput stream.
[in]fft2d_infoFFT2DInfo to output.
Returns
Modified output stream.

Definition at line 2990 of file TypePrinter.h.

References FFT2DInfo::axis0, FFT2DInfo::axis1, and FFT2DInfo::direction.

2991 {
2992  os << "{axis=" << fft2d_info.axis0 << ", "
2993  << "axis=" << fft2d_info.axis1 << ", "
2994  << "direction=" << fft2d_info.direction << "}";
2995  return os;
2996 }

◆ operator<<() [71/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Coordinates2D coord_2d 
)

Formatted output of the Coordinates2D type.

Parameters
[out]osOutput stream.
[in]coord_2dCoordinates2D to output.
Returns
Modified output stream.

Definition at line 3018 of file TypePrinter.h.

References Coordinates2D::x, and Coordinates2D::y.

3019 {
3020  os << "{x=" << coord_2d.x << ", "
3021  << "y=" << coord_2d.y << "}";
3022  return os;
3023 }
int x
The x coordinate.
Definition: types.h:30
int y
The y coordinate.
Definition: types.h:31

◆ operator<<() [72/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const FuseBatchNormalizationType fuse_type 
)

Formatted output of the FuseBatchNormalizationType type.

Parameters
[out]osOutput stream.
[in]fuse_typeFuseBatchNormalizationType to output.
Returns
Modified output stream.

Definition at line 3045 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, CONVOLUTION, and DEPTHWISECONVOLUTION.

3046 {
3047  switch(fuse_type)
3048  {
3049  case FuseBatchNormalizationType::CONVOLUTION:
3050  os << "CONVOLUTION";
3051  break;
3052  case FuseBatchNormalizationType::DEPTHWISECONVOLUTION:
3053  os << "DEPTHWISECONVOLUTION";
3054  break;
3055  default:
3056  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3057  }
3058  return os;
3059 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [73/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const SoftmaxKernelInfo info 
)

Formatted output of the SoftmaxKernelInfo type.

Parameters
[out]osOutput stream.
[in]infoSoftmaxKernelInfo to output.
Returns
Modified output stream.

Definition at line 3081 of file TypePrinter.h.

References SoftmaxKernelInfo::axis, SoftmaxKernelInfo::beta, SoftmaxKernelInfo::input_data_type, and SoftmaxKernelInfo::is_log.

3082 {
3083  os << "{beta=" << info.beta << ", "
3084  << "is_log=" << info.is_log << ", "
3085  << "input_data_type=" << info.input_data_type << ", "
3086  << "axis=" << info.axis << "}";
3087  return os;
3088 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [74/80]

::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const LSTMParams< T > &  lstm_params 
)

Formatted output of the ScaleKernelInfo type.

Parameters
[out]osOutput stream.
[in]lstm_paramsLSTMParams to output.
Returns
Modified output stream.

Definition at line 3111 of file TypePrinter.h.

References to_string().

3112 {
3113  os << "{input_to_input_weights=" << to_string(lstm_params.input_to_input_weights()) << ", "
3114  << "recurrent_to_input_weights=" << to_string(lstm_params.recurrent_to_input_weights()) << ", "
3115  << "cell_to_input_weights=" << to_string(lstm_params.cell_to_input_weights()) << ", "
3116  << "input_gate_bias=" << to_string(lstm_params.input_gate_bias()) << ", "
3117  << "cell_to_forget_weights=" << to_string(lstm_params.cell_to_forget_weights()) << ", "
3118  << "cell_to_output_weights=" << to_string(lstm_params.cell_to_output_weights()) << ", "
3119  << "projection_weights=" << to_string(lstm_params.projection_weights()) << ", "
3120  << "projection_bias=" << to_string(lstm_params.projection_bias()) << ", "
3121  << "input_layer_norm_weights=" << to_string(lstm_params.input_layer_norm_weights()) << ", "
3122  << "forget_layer_norm_weights=" << to_string(lstm_params.forget_layer_norm_weights()) << ", "
3123  << "cell_layer_norm_weights=" << to_string(lstm_params.cell_layer_norm_weights()) << ", "
3124  << "output_layer_norm_weights=" << to_string(lstm_params.output_layer_norm_weights()) << ", "
3125  << "cell_clip=" << lstm_params.cell_clip() << ", "
3126  << "projection_clip=" << lstm_params.projection_clip() << ", "
3127  << "input_intermediate_scale=" << lstm_params.input_intermediate_scale() << ", "
3128  << "forget_intermediate_scale=" << lstm_params.forget_intermediate_scale() << ", "
3129  << "cell_intermediate_scale=" << lstm_params.cell_intermediate_scale() << ", "
3130  << "hidden_state_zero=" << lstm_params.hidden_state_zero() << ", "
3131  << "hidden_state_scale=" << lstm_params.hidden_state_scale() << ", "
3132  << "has_peephole_opt=" << lstm_params.has_peephole_opt() << ", "
3133  << "has_projection=" << lstm_params.has_projection() << ", "
3134  << "has_cifg_opt=" << lstm_params.has_cifg_opt() << ", "
3135  << "use_layer_norm=" << lstm_params.use_layer_norm() << "}";
3136  return os;
3137 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [75/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const NMSType nms_type 
)

Available non maxima suppression types.

Formatted output of the NMSType type.

Parameters
[out]osOutput stream.
[in]nms_typeNMSType to output.
Returns
Modified output stream.

Definition at line 3173 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, GAUSSIAN, LINEAR, and ORIGINAL.

3174 {
3175  switch(nms_type)
3176  {
3177  case NMSType::LINEAR:
3178  os << "LINEAR";
3179  break;
3180  case NMSType::GAUSSIAN:
3181  os << "GAUSSIAN";
3182  break;
3183  case NMSType::ORIGINAL:
3184  os << "ORIGINAL";
3185  break;
3186  default:
3187  ARM_COMPUTE_ERROR("NOT_SUPPORTED!");
3188  }
3189  return os;
3190 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ operator<<() [76/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const BoxNMSLimitInfo info 
)

Formatted output of the BoxNMSLimitInfo type.

Parameters
[out]osOutput stream.
[in]infoBoxNMSLimitInfo to output.
Returns
Modified output stream.

Definition at line 3212 of file TypePrinter.h.

References BoxNMSLimitInfo::detections_per_im(), BoxNMSLimitInfo::im_height(), BoxNMSLimitInfo::im_width(), BoxNMSLimitInfo::min_size(), BoxNMSLimitInfo::nms(), BoxNMSLimitInfo::score_thresh(), BoxNMSLimitInfo::soft_nms_enabled(), BoxNMSLimitInfo::soft_nms_min_score_thres(), and BoxNMSLimitInfo::suppress_size().

3213 {
3214  os << "{score_thresh=" << info.score_thresh() << ", "
3215  << "nms=" << info.nms() << ", "
3216  << "detections_per_im=" << info.detections_per_im() << ", "
3217  << "soft_nms_enabled=" << info.soft_nms_enabled() << ", "
3218  << "soft_nms_min_score_thres=" << info.soft_nms_min_score_thres() << ", "
3219  << "suppress_size=" << info.suppress_size() << ", "
3220  << "min_size=" << info.min_size() << ", "
3221  << "im_width=" << info.im_width() << ", "
3222  << "im_height=" << info.im_height() << "}";
3223  return os;
3224 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ operator<<() [77/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Conv3dInfo conv3d_info 
)

Formatted output of the Conv3dInfo type.

Parameters
[out]osOutput stream.
[in]conv3d_infoType to output.
Returns
Modified output stream.

Definition at line 3259 of file TypePrinter.h.

References Conv3dInfo::act_info, Conv3dInfo::dilation, Conv3dInfo::enable_fast_math, Conv3dInfo::padding, Conv3dInfo::round_type, Conv3dInfo::stride, and to_string().

3260 {
3261  os << conv3d_info.stride;
3262  os << ";";
3263  os << conv3d_info.padding;
3264  os << ";";
3265  os << to_string(conv3d_info.act_info);
3266  os << ";";
3267  os << conv3d_info.dilation;
3268  os << ";";
3269  os << conv3d_info.round_type;
3270  os << ";";
3271  os << conv3d_info.enable_fast_math;
3272 
3273  return os;
3274 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [78/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const arm_compute::WeightFormat wf 
)

Formatted output of the arm_compute::WeightFormat type.

Parameters
[out]osOutput stream.
[in]wfWeightFormat to output.
Returns
Modified output stream.

Definition at line 3351 of file TypePrinter.h.

References to_string().

3352 {
3353  os << to_string(wf);
3354  return os;
3355 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ operator<<() [79/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const Padding2D padding2d 
)

Formatted output of the Padding2D type.

Parameters
[out]osOutput stream.
[in]padding2dPadding info for 2D dimension shape.
Returns
Modified output stream.

Definition at line 3382 of file TypePrinter.h.

References Padding2D::bottom, Padding2D::left, Padding2D::right, and Padding2D::top.

3383 {
3384  os << padding2d.left << "," << padding2d.right << ","
3385  << padding2d.top << "," << padding2d.bottom;
3386  return os;
3387 }

◆ operator<<() [80/80]

inline ::std::ostream& arm_compute::operator<< ( ::std::ostream &  os,
const experimental::dynamic_fusion::Conv2dAttributes conv2d_attr 
)

Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.

Parameters
[out]osOutput stream.
[in]conv2d_attrarm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
Returns
Modified output stream.

Definition at line 3409 of file TypePrinter.h.

References Conv2dAttributes::dilation(), Conv2dAttributes::pad(), and Conv2dAttributes::stride().

3410 {
3411  os << "Conv2dAttributes="
3412  << "["
3413  << "Padding=" << conv2d_attr.pad() << ", "
3414  << "Size2D=" << conv2d_attr.stride() << ", "
3415  << "Dialation=" << conv2d_attr.dilation() << "]";
3416 
3417  return os;
3418 }

◆ operator==() [1/6]

bool arm_compute::operator== ( const QuantizationInfo lhs,
const QuantizationInfo rhs 
)
inline

Check whether two quantization info are equal.

Parameters
[in]lhsRHS quantization info.
[in]rhsLHS quantization info.
Returns
True if the given quantization info is the same.

Definition at line 171 of file QuantizationInfo.h.

References QuantizationInfo::offset(), and QuantizationInfo::scale().

172 {
173  return (lhs.scale() == rhs.scale()) && (lhs.offset() == rhs.offset());
174 }

◆ operator==() [2/6]

bool arm_compute::operator== ( const UniformQuantizationInfo lhs,
const UniformQuantizationInfo rhs 
)
inline

Check whether two quantization info are equal.

Parameters
[in]lhsRHS quantization info.
[in]rhsLHS quantization info.
Returns
True if the given quantization info is the same.

Definition at line 195 of file QuantizationInfo.h.

References UniformQuantizationInfo::offset, and UniformQuantizationInfo::scale.

196 {
197  return (lhs.scale == rhs.scale) && (lhs.offset == rhs.offset);
198 }

◆ operator==() [3/6]

bool arm_compute::operator== ( const ValidRegion lhs,
const ValidRegion rhs 
)
inline
Parameters
[in]lhsLHS valid region
[in]rhsRHS valid region
Returns
True if the valid regions are the same.

Definition at line 268 of file Types.h.

References ValidRegion::anchor, and ValidRegion::shape.

269 {
270  return (lhs.anchor == rhs.anchor) && (lhs.shape == rhs.shape);
271 }

◆ operator==() [4/6]

bool arm_compute::operator== ( const Dimensions< T > &  lhs,
const Dimensions< T > &  rhs 
)
inline

Check that given dimensions are equal.

Parameters
[in]lhsLeft-hand side Dimensions.
[in]rhsRight-hand side Dimensions.
Returns
True if the given dimensions are equal.

Definition at line 276 of file Dimensions.h.

References Dimensions< T >::cbegin(), Dimensions< T >::cend(), and Dimensions< T >::num_dimensions().

Referenced by operator!=(), and ValidRegion::set().

277 {
278  return ((lhs.num_dimensions() == rhs.num_dimensions()) && std::equal(lhs.cbegin(), lhs.cend(), rhs.cbegin()));
279 }

◆ operator==() [5/6]

bool arm_compute::operator== ( const Window lhs,
const Window rhs 
)
inline
Parameters
[in]lhsLHS window
[in]rhsRHS window
Returns
True if the given windows are the same.

Definition at line 309 of file Window.inl.

310 {
311  return (lhs._dims == rhs._dims) && (lhs._is_broadcasted == rhs._is_broadcasted);
312 }

◆ operator==() [6/6]

bool arm_compute::operator== ( const TensorInfo lhs,
const TensorInfo rhs 
)
inline

Check whether two tensor info are equal.

Parameters
[in]lhsLHS tensor info.
[in]rhsRHS tensor info.
Returns
True if the given tensor infos are the same.

Definition at line 342 of file TensorInfo.h.

343 {
344  return (lhs._total_size == rhs._total_size) && (lhs._offset_first_element_in_bytes == rhs._offset_first_element_in_bytes) && (lhs._strides_in_bytes == rhs._strides_in_bytes)
345  && (lhs._num_channels == rhs._num_channels) && (lhs._tensor_shape == rhs._tensor_shape) && (lhs._dims_state == rhs._dims_state) && (lhs._data_type == rhs._data_type) && (lhs._format == rhs._format)
346  && (lhs._is_resizable == rhs._is_resizable) && (lhs._valid_region == rhs._valid_region) && (lhs._padding == rhs._padding) && (lhs._quantization_info == rhs._quantization_info)
347  && (lhs._data_layout == rhs._data_layout) && (lhs._are_values_constant == rhs._are_values_constant)
348  && (lhs._id == rhs._id);
349 }

◆ operator>>() [1/4]

inline ::std::istream& arm_compute::operator>> ( ::std::istream &  is,
BorderMode mode 
)

Formatted input of the BorderMode type.

Parameters
[out]isInput stream.
[in]modeBorder mode.
Returns
the modified input stream.

Definition at line 42 of file TypeReader.h.

References CONSTANT, REPLICATE, and UNDEFINED.

43 {
44  std::string value;
45 
46  is >> value;
47 
48  std::transform(value.begin(), value.end(), value.begin(), [](unsigned char c)
49  {
50  return std::toupper(c);
51  });
52 
53  if(value == "UNDEFINED")
54  {
55  mode = BorderMode::UNDEFINED;
56  }
57  else if(value == "CONSTANT")
58  {
59  mode = BorderMode::CONSTANT;
60  }
61  else if(value == "REPLICATE")
62  {
63  mode = BorderMode::REPLICATE;
64  }
65  else
66  {
67  throw std::invalid_argument("Unsupported value '" + value + "' for border mode");
68  }
69 
70  return is;
71 }

◆ operator>>() [2/4]

inline ::std::istream& arm_compute::operator>> ( ::std::istream &  stream,
arm_compute::DataLayout data_layout 
)

Input Stream operator for DataLayout.

Parameters
[in]streamStream to parse
[out]data_layoutOutput data layout
Returns
Updated stream

Definition at line 48 of file TypeLoader.h.

References data_layout_from_name(), name, and arm_compute::graph::target_from_name().

49 {
50  std::string value;
51  stream >> value;
53  return stream;
54 }
arm_compute::DataLayout data_layout_from_name(const std::string &name)
Converts a string to a strong types enumeration DataLayout.
Definition: TypeLoader.cpp:32

◆ operator>>() [3/4]

inline ::std::istream& arm_compute::operator>> ( ::std::istream &  stream,
CLTunerMode tuner_mode 
)

Input Stream operator for CLTunerMode.

Parameters
[in]streamStream to parse
[out]tuner_modeOutput tuner mode
Returns
Updated stream

Definition at line 88 of file CLTunerTypes.h.

References tuner_mode_from_name().

89 {
90  std::string value;
91  stream >> value;
92  tuner_mode = tuner_mode_from_name(value);
93  return stream;
94 }
CLTunerMode tuner_mode_from_name(const std::string &name)
Converts a string to a strong types enumeration CLTunerMode.
Definition: CLTunerTypes.h:57

◆ operator>>() [4/4]

inline ::std::istream& arm_compute::operator>> ( ::std::istream &  stream,
DataType data_type 
)

Input Stream operator for DataType.

Parameters
[in]streamStream to parse
[out]data_typeOutput data type
Returns
Updated stream

Definition at line 981 of file Utils.h.

References data_type_from_name(), lower_string(), and upper_string().

982 {
983  std::string value;
984  stream >> value;
986  return stream;
987 }
DataType data_type_from_name(const std::string &name)
Convert a string to DataType.
Definition: Utils.cpp:328

◆ permute() [1/2]

void arm_compute::permute ( Dimensions< T > &  dimensions,
const PermutationVector perm 
)
inline

Permutes given Dimensions according to a permutation vector.

Warning
Validity of permutation is not checked
Parameters
[in,out]dimensionsDimensions to permute
[in]permPermutation vector

Definition at line 125 of file Helpers.h.

References Dimensions< T >::begin(), Dimensions< T >::end(), Dimensions< T >::num_dimensions(), and Dimensions< T >::set().

Referenced by arm_compute::misc::shape_calculator::compute_permutation_output_shape(), PermuteLayerNode::configure_output(), arm_compute::test::validation::DATA_TEST_CASE(), NPYLoader::fill_tensor(), AssetsLibrary::fill_with_generator(), arm_compute::graph_utils::permute_shape(), arm_compute::test::validation::TEST_CASE(), CLDepthwiseConvolutionLayer::validate(), CLGEMMDeconvolutionLayer::validate(), arm_compute::test::validation::validate(), and arm_compute::test::validation::validate_wrap().

126 {
127  auto dimensions_copy = utility::make_array<Dimensions<T>::num_max_dimensions>(dimensions.begin(), dimensions.end());
128  for(unsigned int i = 0; i < perm.num_dimensions(); ++i)
129  {
130  T dimension_val = (perm[i] < dimensions.num_dimensions()) ? dimensions_copy[perm[i]] : 0;
131  dimensions.set(i, dimension_val);
132  }
133 }

◆ permute() [2/2]

void arm_compute::permute ( TensorShape shape,
const PermutationVector perm 
)
inline

Permutes given TensorShape according to a permutation vector.

Warning
Validity of permutation is not checked
Parameters
[in,out]shapeShape to permute
[in]permPermutation vector

Definition at line 142 of file Helpers.h.

References calculate_valid_region_scale(), coords2index(), arm_compute::test::validation::data_layout, arm_compute::test::validation::dst_shape, get_data_layout_dimension_index(), get_index_data_layout_dimension(), get_layout_map(), index2coords(), Dimensions< T >::num_dimensions(), arm_compute::test::validation::sampling_policy, TensorShape::set(), arm_compute::test::validation::shape, and arm_compute::test::validation::src_info.

143 {
144  TensorShape shape_copy = shape;
145  for(unsigned int i = 0; i < perm.num_dimensions(); ++i)
146  {
147  size_t dimension_val = (perm[i] < shape.num_dimensions()) ? shape_copy[perm[i]] : 1;
148  shape.set(i, dimension_val, false, false); // Avoid changes in _num_dimension
149  }
150 }

◆ permute_strides()

void arm_compute::permute_strides ( Dimensions< T > &  dimensions,
const PermutationVector perm 
)
inline

Permutes the given dimensions according the permutation vector.

Parameters
[in,out]dimensionsDimensions to be permuted.
[in]permVector describing the permutation.

Definition at line 728 of file Utils.h.

References Dimensions< T >::begin(), calculate_same_pad(), arm_compute::test::validation::conv_info, arm_compute::test::validation::data_layout, arm_compute::test::validation::data_type, deconvolution_output_dimensions(), dl, dt, Dimensions< T >::end(), FLOOR, get_quantized_activation_min_max(), get_softmax_output_quantization_info(), arm_compute::test::validation::info, arm_compute::test::validation::input_shape, is_pool_3d_region_entirely_outside_input(), is_pool_region_entirely_outside_input(), NCHW, needs_serialized_reduction(), Dimensions< T >::num_dimensions(), scaled_3d_dimensions_signed(), scaled_dimensions(), scaled_dimensions_signed(), Dimensions< T >::set(), string_from_activation_func(), string_from_border_mode(), string_from_channel(), string_from_data_layout(), string_from_data_type(), string_from_format(), string_from_interpolation_policy(), string_from_norm_type(), string_from_pooling_type(), type, arm_compute::utils::cast::U, and arm_compute::test::validation::weights_shape.

729 {
730  const auto old_dim = utility::make_array<Dimensions<T>::num_max_dimensions>(dimensions.begin(), dimensions.end());
731  for(unsigned int i = 0; i < perm.num_dimensions(); ++i)
732  {
733  T dimension_val = old_dim[i];
734  dimensions.set(perm[i], dimension_val);
735  }
736 }

◆ pixel_size_from_format()

size_t arm_compute::pixel_size_from_format ( Format  format)
inline

The size in bytes of the pixel format.

Parameters
[in]formatInput format
Returns
The size in bytes of the pixel format

Definition at line 146 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UV88, UYVY422, YUV444, and YUYV422.

147 {
148  switch(format)
149  {
150  case Format::U8:
151  return 1;
152  case Format::U16:
153  case Format::S16:
154  case Format::BFLOAT16:
155  case Format::F16:
156  case Format::UV88:
157  case Format::YUYV422:
158  case Format::UYVY422:
159  return 2;
160  case Format::RGB888:
161  return 3;
162  case Format::RGBA8888:
163  return 4;
164  case Format::U32:
165  case Format::S32:
166  case Format::F32:
167  return 4;
168  //Doesn't make sense for planar formats:
169  case Format::NV12:
170  case Format::NV21:
171  case Format::IYUV:
172  case Format::YUV444:
173  default:
174  ARM_COMPUTE_ERROR("Undefined pixel size for given format");
175  return 0;
176  }
177 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ plane_idx_from_channel()

int arm_compute::plane_idx_from_channel ( Format  format,
Channel  channel 
)
inline

Return the plane index of a given channel given an input format.

Parameters
[in]formatInput format
[in]channelInput channel
Returns
The plane index of the specific channel of the specific format

Definition at line 262 of file Utils.h.

References ARM_COMPUTE_ERROR, BFLOAT16, F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U, U16, U32, U8, UV88, UYVY422, V, Y, YUV444, and YUYV422.

263 {
264  switch(format)
265  {
266  // Single planar formats have a single plane
267  case Format::U8:
268  case Format::U16:
269  case Format::S16:
270  case Format::U32:
271  case Format::S32:
272  case Format::BFLOAT16:
273  case Format::F16:
274  case Format::F32:
275  case Format::UV88:
276  case Format::RGB888:
277  case Format::RGBA8888:
278  case Format::YUYV422:
279  case Format::UYVY422:
280  return 0;
281  // Multi planar formats
282  case Format::NV12:
283  case Format::NV21:
284  {
285  // Channel U and V share the same plane of format UV88
286  switch(channel)
287  {
288  case Channel::Y:
289  return 0;
290  case Channel::U:
291  case Channel::V:
292  return 1;
293  default:
294  ARM_COMPUTE_ERROR("Not supported channel");
295  return 0;
296  }
297  }
298  case Format::IYUV:
299  case Format::YUV444:
300  {
301  switch(channel)
302  {
303  case Channel::Y:
304  return 0;
305  case Channel::U:
306  return 1;
307  case Channel::V:
308  return 2;
309  default:
310  ARM_COMPUTE_ERROR("Not supported channel");
311  return 0;
312  }
313  }
314  default:
315  ARM_COMPUTE_ERROR("Not supported format");
316  return 0;
317  }
318 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ preferred_dummy_work_items_support()

bool preferred_dummy_work_items_support ( const cl::Device &  device)

Helper function to check if "dummy work-items" are preferred to have a power of two NDRange In case dummy work-items is enabled, it is OpenCL kernel responsibility to check if the work-item is out-of range or not.

Parameters
[in]deviceA CL device
Returns
True if dummy work-items should be preferred to dispatch the NDRange

Definition at line 367 of file CLHelpers.cpp.

References ARM_COMPUTE_UNUSED.

Referenced by ClGemmLowpMatrixMultiplyNativeKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), ClGemmLowpMatrixMultiplyReshapedKernel::configure(), ClGemmLowpMatrixMultiplyReshapedOnlyRhsKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), and ClGemmMatrixMultiplyReshapedKernel::configure().

368 {
369  ARM_COMPUTE_UNUSED(device);
370  // TODO (COMPMID-2044)
371  return true;
372 }
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

◆ preferred_vector_width()

size_t preferred_vector_width ( const cl::Device &  device,
DataType  dt 
)

Helper function to get the preferred native vector width size for built-in scalar types that can be put into vectors.

Parameters
[in]deviceA CL device
[in]dtdata type
Returns
preferred vector width

Definition at line 337 of file CLHelpers.cpp.

References F16, F32, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, U16, U32, U64, and U8.

338 {
339  switch(dt)
340  {
341  case DataType::U8:
342  case DataType::S8:
343  case DataType::QASYMM8:
344  case DataType::QASYMM8_SIGNED:
345  case DataType::QSYMM8:
346  case DataType::QSYMM8_PER_CHANNEL:
347  return device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR>();
348  case DataType::U16:
349  case DataType::S16:
350  case DataType::QSYMM16:
351  case DataType::QASYMM16:
352  return device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT>();
353  case DataType::U32:
354  case DataType::S32:
355  return device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT>();
356  case DataType::F16:
357  case DataType::F32:
358  return device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT>();
359  case DataType::U64:
360  case DataType::S64:
361  return device.getInfo<CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG>();
362  default:
363  return 1;
364  }
365 }

◆ qasymm8_hard_swish()

qasymm8_t arm_compute::qasymm8_hard_swish ( qasymm8_t  in,
const UniformQuantizationInfo qi_in,
const UniformQuantizationInfo qi_out 
)
inline

Definition at line 402 of file QuantizationInfo.h.

References dequantize_qasymm8(), and quantize_qasymm8().

Referenced by ActivationLayerInfo::is_lut_supported().

405 {
406  float tmp_f = dequantize_qasymm8(in, qi_in);
407  tmp_f = tmp_f * ((std::min(std::max((tmp_f + 3), 0.0f), 6.0f)) * 0.166666667f);
408  const qasymm8_t tmp = quantize_qasymm8(tmp_f, qi_out);
409  return tmp;
410 }
float dequantize_qasymm8(uchar input, float offset, float scale)
Dequantize a scalar value from 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:62
uchar quantize_qasymm8(float input, float offset, float scale)
Quantize a floating-point scalar value to 8-bit asymmetric.
Definition: helpers_asymm.h:47
uint8_t qasymm8_t
8 bit quantized asymmetric scalar value

◆ qasymm8_leaky_relu()

qasymm8_t arm_compute::qasymm8_leaky_relu ( qasymm8_t  in,
const UniformQuantizationInfo qi_in,
const UniformQuantizationInfo qi_out,
float  alpha 
)
inline

Definition at line 422 of file QuantizationInfo.h.

References dequantize_qasymm8(), and quantize_qasymm8().

Referenced by ActivationLayerInfo::is_lut_supported().

426 {
427  float tmp_f = dequantize_qasymm8(in, qi_in);
428  tmp_f = tmp_f > 0 ? tmp_f : tmp_f * alpha;
429  const qasymm8_t tmp = quantize_qasymm8(tmp_f, qi_out);
430  return tmp;
431 }
float dequantize_qasymm8(uchar input, float offset, float scale)
Dequantize a scalar value from 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:62
uchar quantize_qasymm8(float input, float offset, float scale)
Quantize a floating-point scalar value to 8-bit asymmetric.
Definition: helpers_asymm.h:47
uint8_t qasymm8_t
8 bit quantized asymmetric scalar value

◆ qasymm8_logistic()

qasymm8_t arm_compute::qasymm8_logistic ( qasymm8_t  in,
const UniformQuantizationInfo qi_in,
const UniformQuantizationInfo qi_out 
)
inline

Definition at line 433 of file QuantizationInfo.h.

References dequantize_qasymm8(), and quantize_qasymm8().

Referenced by ActivationLayerInfo::is_lut_supported().

436 {
437  float tmp_f = dequantize_qasymm8(in, qi_in);
438  tmp_f = 1.f / (1.f + std::exp(-tmp_f));
439  const qasymm8_t tmp = quantize_qasymm8(tmp_f, qi_out);
440  return tmp;
441 }
float dequantize_qasymm8(uchar input, float offset, float scale)
Dequantize a scalar value from 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:62
uchar quantize_qasymm8(float input, float offset, float scale)
Quantize a floating-point scalar value to 8-bit asymmetric.
Definition: helpers_asymm.h:47
uint8_t qasymm8_t
8 bit quantized asymmetric scalar value

◆ qasymm8_signed_hard_swish()

qasymm8_signed_t arm_compute::qasymm8_signed_hard_swish ( qasymm8_signed_t  in,
const UniformQuantizationInfo qi_in,
const UniformQuantizationInfo qi_out 
)
inline

Definition at line 412 of file QuantizationInfo.h.

References dequantize_qasymm8_signed(), and quantize_qasymm8_signed().

Referenced by ActivationLayerInfo::is_lut_supported().

415 {
416  float tmp_f = dequantize_qasymm8_signed(in, qi_in);
417  tmp_f = tmp_f * ((std::min(std::max((tmp_f + 3), 0.0f), 6.0f)) * 0.166666667f);
418  const qasymm8_t tmp = quantize_qasymm8_signed(tmp_f, qi_out);
419  return tmp;
420 }
int8_t quantize_qasymm8_signed(float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given a signed 8-bit asymmetric quantization scheme.
float dequantize_qasymm8_signed(char input, float offset, float scale)
Dequantize a scalar value from signed 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:75
uint8_t qasymm8_t
8 bit quantized asymmetric scalar value

◆ qasymm8_signed_logistic()

qasymm8_signed_t arm_compute::qasymm8_signed_logistic ( qasymm8_signed_t  in,
const UniformQuantizationInfo qi_in,
const UniformQuantizationInfo qi_out 
)
inline

Definition at line 443 of file QuantizationInfo.h.

References dequantize_qasymm8_signed(), and quantize_qasymm8_signed().

Referenced by ActivationLayerInfo::is_lut_supported().

446 {
447  float tmp_f = dequantize_qasymm8_signed(in, qi_in);
448  tmp_f = 1.f / (1.f + std::exp(-tmp_f));
449  const qasymm8_signed_t tmp = quantize_qasymm8_signed(tmp_f, qi_out);
450  return tmp;
451 }
int8_t quantize_qasymm8_signed(float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given a signed 8-bit asymmetric quantization scheme.
float dequantize_qasymm8_signed(char input, float offset, float scale)
Dequantize a scalar value from signed 8-bit asymmetric to floating-point.
Definition: helpers_asymm.h:75
int8_t qasymm8_signed_t
8 bit signed quantized asymmetric scalar value

◆ quantize_qasymm16() [1/2]

uint16_t arm_compute::quantize_qasymm16 ( float  value,
const UniformQuantizationInfo qinfo,
RoundingPolicy  rounding_policy = RoundingPolicy::TO_NEAREST_UP 
)
inline

Quantize a value given a 16-bit asymmetric quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
[in]rounding_policy(Optional) Rounding policy to use. Default: nearest up
Returns
Quantized value

Definition at line 549 of file QuantizationInfo.h.

References UniformQuantizationInfo::offset, round(), and UniformQuantizationInfo::scale.

Referenced by arm_compute::cpu::bounding_box_transform_qsymm16(), arm_compute::test::validation::convert_to_asymmetric(), PixelValue::PixelValue(), arm_compute::test::validation::reference::quantization_layer(), quantize_qasymm16(), and CpuQuantizeKernel::validate().

550 {
551  int quantized = arm_compute::round(value / qinfo.scale, rounding_policy) + qinfo.offset;
552  quantized = arm_compute::utility::clamp<int, uint16_t>(quantized);
553  return quantized;
554 }
const std::vector< int32_t > & offset() const
Offset vector accessor.
const std::vector< float > & scale() const
Scale vector accessor.
int round(float x, RoundingPolicy rounding_policy)
Return a rounded value of x.
Definition: Rounding.cpp:35
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ quantize_qasymm16() [2/2]

uint16_t arm_compute::quantize_qasymm16 ( float  value,
const QuantizationInfo qinfo 
)
inline

Quantize a value given a 16-bit asymmetric quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
Returns
Quantized value

Definition at line 575 of file QuantizationInfo.h.

References quantize_qasymm16(), and QuantizationInfo::uniform().

576 {
577  return quantize_qasymm16(value, qinfo.uniform());
578 }
UniformQuantizationInfo uniform() const
Return per layer quantization info.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155
uint16_t quantize_qasymm16(float value, const QuantizationInfo &qinfo)
Quantize a value given a 16-bit asymmetric quantization scheme.

◆ quantize_qasymm8()

uint8_t arm_compute::quantize_qasymm8 ( float  value,
const INFO_TYPE &  qinfo,
RoundingPolicy  rounding_policy = RoundingPolicy::TO_NEAREST_UP 
)
inline

◆ quantize_qasymm8_signed()

int8_t arm_compute::quantize_qasymm8_signed ( float  value,
const INFO_TYPE &  qinfo,
RoundingPolicy  rounding_policy = RoundingPolicy::TO_NEAREST_UP 
)
inline

◆ quantize_qsymm16() [1/2]

int16_t arm_compute::quantize_qsymm16 ( float  value,
const UniformQuantizationInfo qinfo,
RoundingPolicy  rounding_policy = RoundingPolicy::TO_NEAREST_UP 
)
inline

Quantize a value given a 16-bit symmetric quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
[in]rounding_policy(Optional) Rounding policy to use. Default: nearest up
Returns
Quantized value

Definition at line 498 of file QuantizationInfo.h.

References round(), and UniformQuantizationInfo::scale.

Referenced by arm_compute::cpu::add_qsymm16_neon(), arm_compute::cpu::compute_all_anchors_qasymm16(), ClActivationKernel::configure(), NEQLSTMLayer::configure(), CLQLSTMLayer::configure(), arm_compute::test::validation::convert_to_symmetric(), arm_compute::cpu::neon_qsymm16_activation(), PixelValue::PixelValue(), quantize_qsymm16(), arm_compute::cpu::sub_qsymm16_neon(), NEQLSTMLayer::validate(), and CLQLSTMLayer::validate().

499 {
500  int quantized = arm_compute::round(value / qinfo.scale, rounding_policy);
501  quantized = arm_compute::utility::clamp<int, int16_t>(quantized);
502  return quantized;
503 }
const std::vector< float > & scale() const
Scale vector accessor.
int round(float x, RoundingPolicy rounding_policy)
Return a rounded value of x.
Definition: Rounding.cpp:35
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ quantize_qsymm16() [2/2]

int16_t arm_compute::quantize_qsymm16 ( float  value,
const QuantizationInfo qinfo 
)
inline

Quantize a value given a 16-bit symmetric quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
Returns
Quantized value

Definition at line 524 of file QuantizationInfo.h.

References quantize_qsymm16(), and QuantizationInfo::uniform().

525 {
526  return quantize_qsymm16(value, qinfo.uniform());
527 }
UniformQuantizationInfo uniform() const
Return per layer quantization info.
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155
int16_t quantize_qsymm16(float value, const QuantizationInfo &qinfo)
Quantize a value given a 16-bit symmetric quantization scheme.

◆ quantize_qsymm8()

int8_t arm_compute::quantize_qsymm8 ( float  value,
const QuantizationInfo qinfo 
)
inline

Quantize a value given a 8-bit symmetric quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
Returns
Quantized value

Definition at line 329 of file QuantizationInfo.h.

References round(), UniformQuantizationInfo::scale, TO_NEAREST_UP, and QuantizationInfo::uniform().

Referenced by PixelValue::PixelValue(), and CpuQuantizeKernel::validate().

330 {
331  int quantized = arm_compute::round(value / qinfo.uniform().scale, RoundingPolicy::TO_NEAREST_UP);
332  quantized = std::max(-128, std::min(quantized, 127));
333  return quantized;
334 }
UniformQuantizationInfo uniform() const
Return per layer quantization info.
int round(float x, RoundingPolicy rounding_policy)
Return a rounded value of x.
Definition: Rounding.cpp:35
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ quantize_qsymm8_per_channel()

int8_t arm_compute::quantize_qsymm8_per_channel ( float  value,
const QuantizationInfo qinfo,
size_t  channel_id = 0 
)
inline

Quantize a value given a 8-bit symmetric per channel quantization scheme.

Parameters
[in]valueValue to quantize
[in]qinfoQuantization information to use for quantizing
[in]channel_idchannel index into the scale vector of quantization info
Returns
Quantized value

Definition at line 344 of file QuantizationInfo.h.

References round(), QuantizationInfo::scale(), and TO_NEAREST_UP.

Referenced by arm_compute::test::validation::get_symm_quantized_per_channel_bounds().

345 {
346  int quantized = arm_compute::round(value / qinfo.scale()[channel_id], RoundingPolicy::TO_NEAREST_UP);
347  quantized = std::max(-128, std::min(quantized, 127));
348  return quantized;
349 }
const std::vector< float > & scale() const
Scale vector accessor.
int round(float x, RoundingPolicy rounding_policy)
Return a rounded value of x.
Definition: Rounding.cpp:35
const QuantizationInfo qinfo
Definition: Im2Col.cpp:155

◆ read_file()

std::string read_file ( const std::string &  filename,
bool  binary 
)

Load an entire file in memory.

Parameters
[in]filenameName of the file to read.
[in]binaryIs it a binary file ?
Returns
The content of the file.

Definition at line 38 of file Utils.cpp.

References ARM_COMPUTE_ERROR_VAR, arm_compute::mlgo::parser::end(), and clang_tidy_rules::mode.

Referenced by floor_to_multiple(), and ClKernelLibrary::program().

39 {
40  std::string out;
41  std::ifstream fs;
42 
43 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
44  try
45  {
46 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
47  fs.exceptions(std::ifstream::failbit | std::ifstream::badbit);
48  std::ios_base::openmode mode = std::ios::in;
49 
50  if(binary)
51  {
52  mode |= std::ios::binary;
53  }
54 
55  fs.open(filename, mode);
56 
57  // Go to the end of the file
58  fs.seekg(0, std::ios::end);
59  // Reserve the memory required to store the file's content
60  out.reserve(fs.tellg());
61  // Go back to the beginning of the file
62  fs.seekg(0, std::ios::beg);
63  // Copy the content of the file
64  out.assign(std::istreambuf_iterator<char>(fs), std::istreambuf_iterator<char>());
65 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
66  }
67  catch(const std::ifstream::failure &e)
68  {
69  ARM_COMPUTE_ERROR_VAR("Accessing %s: %s", filename.c_str(), e.what());
70  }
71 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
72 
73  return out;
74 }
#define ARM_COMPUTE_ERROR_VAR(msg,...)
Print the given message then throw an std::runtime_error.
Definition: Error.h:346
void end(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:290

◆ release_prepare_tensors()

void arm_compute::release_prepare_tensors ( WorkspaceData< TensorType > &  workspace,
ITensorPack prep_pack 
)

Definition at line 104 of file MemoryHelpers.h.

References arm_compute::experimental::Prepare, and ITensorPack::remove_tensor().

Referenced by CLWinogradConvolutionLayer::prepare().

105 {
106  workspace.erase(std::remove_if(workspace.begin(),
107  workspace.end(),
108  [&prep_pack](auto & wk)
109  {
110  const bool to_erase = wk.lifetime == experimental::MemoryLifetime::Prepare;
111  if(to_erase)
112  {
113  prep_pack.remove_tensor(wk.slot);
114  }
115  return to_erase;
116  }),
117  workspace.end());
118 }

◆ release_temporaries()

void arm_compute::release_temporaries ( const experimental::MemoryRequirements mem_reqs,
WorkspaceData< TensorType > &  workspace 
)

Utility function to release tensors with lifetime marked as Prepare.

Definition at line 122 of file MemoryHelpers.h.

References arm_compute::test::validation::m, arm_compute::experimental::Prepare, WorkspaceDataElement< TensorType >::slot, and WorkspaceDataElement< TensorType >::tensor.

Referenced by CLGEMMLowpMatrixMultiplyCore::prepare(), CLGEMMConvolutionLayer::prepare(), and CLConvolutionLayer::prepare().

124 {
125  for(auto &ws : workspace)
126  {
127  const int slot = ws.slot;
128  for(auto &m : mem_reqs)
129  {
130  if(m.slot == slot && m.lifetime == experimental::MemoryLifetime::Prepare)
131  {
132  auto tensor = ws.tensor.get();
133  tensor->allocator()->free();
134  break;
135  }
136  }
137  }
138 }
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ restore_program_cache_from_file()

void restore_program_cache_from_file ( const std::string &  filename = "cache.bin")

This function loads prebuilt opencl kernels from a file.

Parameters
[in]filenameName of the file to be used to load the kernels

Definition at line 35 of file Utils.cpp.

References CLKernelLibrary::add_built_program(), CLScheduler::context(), CLScheduler::default_init(), CLKernelLibrary::get(), CLScheduler::get(), CLScheduler::is_initialised(), and name.

36 {
37  std::ifstream cache_file(filename, std::ios::binary);
38  if(cache_file.is_open())
39  {
40  if(!CLScheduler::get().is_initialised())
41  {
43  }
44 
45  while(!cache_file.eof())
46  {
47  size_t name_len = 0;
48  size_t binary_len = 0;
49  cache_file.read(reinterpret_cast<char *>(&name_len), sizeof(size_t));
50  cache_file.read(reinterpret_cast<char *>(&binary_len), sizeof(size_t));
51  if(name_len == 0 || binary_len == 0)
52  {
53  break;
54  }
55  std::vector<char> tmp(name_len);
56  std::vector<unsigned char> binary(binary_len);
57  std::string name;
58  cache_file.read(tmp.data(), name_len);
59  name.assign(tmp.data(), name_len);
60  tmp.resize(binary_len);
61  cache_file.read(reinterpret_cast<char *>(binary.data()), binary_len);
62  cl::Context context = arm_compute::CLScheduler::get().context();
63  cl::Program::Binaries binaries{ binary };
64  std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
65  cl::Program program(context, devices, binaries);
66  program.build();
67  CLKernelLibrary::get().add_built_program(name, program);
68  }
69  cache_file.close();
70  }
71 }
static CLScheduler & get()
Access the scheduler singleton.
void default_init(ICLTuner *cl_tuner=nullptr, CLGEMMHeuristicsHandle *gemm_h=nullptr, CLBackendType cl_backend_type=CLBackendType::Native)
Initialises the context and command queue used by the scheduler to default values and sets a default ...
cl::Context & context()
Accessor for the associated CL context.
Definition: CLScheduler.cpp:36
const char * name

◆ round()

int round ( float  x,
RoundingPolicy  rounding_policy 
)

Return a rounded value of x.

Rounding is done according to the rounding_policy.

Parameters
[in]xFloat value to be rounded.
[in]rounding_policyPolicy determining how rounding is done.
Returns
Rounded value of the argument x.

Definition at line 35 of file Rounding.cpp.

References ARM_COMPUTE_ERROR, arm_compute::support::cpp11::round(), TO_NEAREST_EVEN, TO_NEAREST_UP, and TO_ZERO.

Referenced by DATA_TEST_CASE(), Qasymm8QuantizationHelper< QUANTIZED_TYPE >::quantize(), quantize_qasymm16(), quantize_qsymm16(), quantize_qsymm8(), quantize_qsymm8_per_channel(), roi_pooling_layer(), scale_nearest_neighbour_nchw(), arm_compute::scheduler_utils::split_2d(), arm_compute::cpu::sve2_qasymm8_activation(), and arm_compute::cpu::sve2_qasymm8_signed_activation().

36 {
37  using namespace std;
38  int rounded = 0;
39  switch(rounding_policy)
40  {
41  case RoundingPolicy::TO_ZERO:
42  {
43  rounded = static_cast<int>(x);
44  break;
45  }
46  case RoundingPolicy::TO_NEAREST_UP:
47  {
48  rounded = static_cast<int>(support::cpp11::round(x));
49  break;
50  }
51  case RoundingPolicy::TO_NEAREST_EVEN:
52  {
53 #ifdef __aarch64__
54  asm("fcvtns %x[res], %s[value]"
55  : [res] "=r"(rounded)
56  : [value] "w"(x));
57 #else // __aarch64__
58  ARM_COMPUTE_ERROR("TO_NEAREST_EVEN rounding policy is not supported.");
59 #endif // __aarch64__
60  break;
61  }
62  default:
63  {
64  ARM_COMPUTE_ERROR("Unsupported rounding policy.");
65  break;
66  }
67  }
68 
69  return rounded;
70 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
int round(float x, RoundingPolicy rounding_policy)
Return a rounded value of x.
Definition: Rounding.cpp:35

◆ rounding_divide_by_pow2() [1/3]

int32x4_t rounding_divide_by_pow2 ( int32x4_t  x,
int32x4_t  exponent 
)
inline

Round to the nearest division by a power-of-two using exponent.

Note
This function calculates the following expression: (x + 2^n -1 ) / 2^n where n = exponent
Parameters
[in]xVector of 4 elements
[in]exponentVector of 4 elements with integer value used to round to nearest division by a power-of-two
Returns
the nearest division by a power-of-two using exponent

Definition at line 339 of file NEMath.inl.

Referenced by finalize_quantization(), finalize_quantization_int16(), finalize_quantization_symm(), and multiply_by_quantized_multiplier_2row().

340 {
341  const int32x4_t shift_vec = vnegq_s32(exponent);
342  const int32x4_t fixup = vshrq_n_s32(vandq_s32(x, shift_vec), 31);
343  const int32x4_t fixed_up_x = vqaddq_s32(x, fixup);
344  return vrshlq_s32(fixed_up_x, shift_vec);
345 }

◆ rounding_divide_by_pow2() [2/3]

int32x4_t rounding_divide_by_pow2 ( int32x4_t  x,
int  exponent 
)
inline

Round to the nearest division by a power-of-two using exponent.

Note
This function calculates the following expression: (x + 2^n -1 ) / 2^n where n = exponent
Parameters
[in]xVector of 4 elements
[in]exponentInteger value used to round to nearest division by a power-of-two
Returns
the nearest division by a power-of-two using exponent

Definition at line 347 of file NEMath.inl.

348 {
349  const int32x4_t shift_vec = vdupq_n_s32(-exponent);
350  const int32x4_t fixup = vshrq_n_s32(vandq_s32(x, shift_vec), 31);
351  const int32x4_t fixed_up_x = vqaddq_s32(x, fixup);
352  return vrshlq_s32(fixed_up_x, shift_vec);
353 }

◆ rounding_divide_by_pow2() [3/3]

int32_t rounding_divide_by_pow2 ( int32_t  x,
int  exponent 
)
inline

Round to the nearest division by a power-of-two using exponent.

Note
This function calculates the following expression: (x + 2^n -1 ) / 2^n where n = exponent
Parameters
[in]xElement to divide.
[in]exponentInteger value used to round to nearest division by a power-of-two
Returns
the nearest division by a power-of-two using exponent

Definition at line 355 of file NEMath.inl.

356 {
357  const int32_t mask = (1 << exponent) - 1;
358  const int32_t threshold = (mask >> 1) + (x < 0 ? 1 : 0);
359  return (x >> exponent) + ((x & mask) > threshold ? 1 : 0);
360 }

◆ run_reverse()

void arm_compute::run_reverse ( const Window window,
const ITensor input,
const ITensor axis,
ITensor output 
)

Definition at line 88 of file NEReverseKernel.cpp.

References ITensor::buffer(), ITensorInfo::dimension(), Window::DimX, ITensorInfo::element_size(), Window::Dimension::end(), execute_window_loop(), ITensor::info(), Iterator::ptr(), ITensor::ptr_to_element(), Window::set(), Window::Dimension::start(), arm_compute::wrapper::vcombine(), arm_compute::wrapper::vgethigh(), arm_compute::wrapper::vgetlow(), arm_compute::wrapper::vloadq(), arm_compute::wrapper::vrev64(), arm_compute::wrapper::vstore(), and Window::x().

89 {
90  int axis_bit = 0;
91  for(unsigned int i = 0; i < axis->info()->dimension(0); ++i)
92  {
93  const int axis_i = *(reinterpret_cast<const int *>(axis->buffer()) + i);
94  axis_bit |= 1 << axis_i;
95  }
96 
97  // Check if we need a left-over loop for the y dimension
98  const int window_step_x = 16 / input->info()->element_size();
99  const int window_start_x = window.x().start();
100  const int window_end_x = window.x().end();
101 
102  Window win(window);
103  win.set(Window::DimX, Window::Dimension(0, 1, 1));
104 
105  Iterator input_it(input, win);
106  execute_window_loop(win, [&](const Coordinates & id)
107  {
108  int x = window_start_x;
109  for(; x <= (window_end_x - window_step_x); x += window_step_x)
110  {
111  auto in = wrapper::vloadq(reinterpret_cast<T *>(input_it.ptr()) + x);
112 
113  // Reverse 0 axis
114  if(axis_bit & 0x1)
115  {
116  in = wrapper::vrev64(in);
118  }
119 
120  const int offset_x = (axis_bit & 0x1) ? output->info()->dimension(0) - x - window_step_x : x;
121  const int offset_y = (axis_bit & 0x2) ? output->info()->dimension(1) - id.y() - 1 : id.y();
122  const int offset_z = (axis_bit & 0x4) ? output->info()->dimension(2) - id.z() - 1 : id.z();
123  const int offset_w = (axis_bit & 0x8) ? output->info()->dimension(3) - id[3] - 1 : id[3];
124 
125  auto out_ptr = reinterpret_cast<T *>(output->ptr_to_element(Coordinates(offset_x, offset_y, offset_z, offset_w)));
126  wrapper::vstore(out_ptr, in);
127  }
128 
129  // Compute left-over elements
130  for(; x < window_end_x; ++x)
131  {
132  const auto in = *(reinterpret_cast<T *>(input_it.ptr()) + x);
133 
134  const int offset_x = (axis_bit & 0x1) ? output->info()->dimension(0) - x - 1 : x;
135  const int offset_y = (axis_bit & 0x2) ? output->info()->dimension(1) - id.y() - 1 : id.y();
136  const int offset_z = (axis_bit & 0x4) ? output->info()->dimension(2) - id.z() - 1 : id.z();
137  const int offset_w = (axis_bit & 0x8) ? output->info()->dimension(3) - id[3] - 1 : id[3];
138 
139  *reinterpret_cast<T *>(output->ptr_to_element(Coordinates(offset_x, offset_y, offset_z, offset_w))) = in;
140  }
141  },
142  input_it);
143 }
uint8x16_t vloadq(const uint8_t *ptr)
Definition: load.h:58
uint8x8_t vgetlow(const uint8x16_t val)
Definition: getlow.h:39
uint8x16_t vcombine(const uint8x8_t &a, const uint8x8_t &b)
Definition: combine.h:39
uint8x8_t vgethigh(const uint8x16_t val)
Definition: gethigh.h:39
uint8x8_t vrev64(const uint8x8_t &a)
Definition: rev64.h:39
void vstore(uint8_t *ptr, uint8x8_t val)
Definition: store.h:39
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
Definition: Helpers.inl:77

◆ save_program_cache_to_file()

void save_program_cache_to_file ( const std::string &  filename = "cache.bin")

This function saves opencl kernels library to a file.

Parameters
[in]filenameName of the file to be used to save the library

Definition at line 73 of file Utils.cpp.

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON, CLKernelLibrary::get(), CLScheduler::get(), CLKernelLibrary::get_built_programs(), and kernel_name.

74 {
75  if(CLScheduler::get().is_initialised())
76  {
77  std::ofstream cache_file(filename, std::ios::binary);
78  if(cache_file.is_open())
79  {
80  for(const auto &it : CLKernelLibrary::get().get_built_programs())
81  {
82  std::vector<std::vector<unsigned char>> binaries = it.second.getInfo<CL_PROGRAM_BINARIES>();
83  ARM_COMPUTE_ERROR_ON(binaries.size() != 1);
84  const std::string kernel_name = it.first;
85  size_t kernel_name_size = kernel_name.length();
86  size_t binary_size = binaries[0].size();
87  cache_file.write(reinterpret_cast<char *>(&kernel_name_size), sizeof(size_t));
88  cache_file.write(reinterpret_cast<char *>(&binary_size), sizeof(size_t));
89  cache_file.write(kernel_name.c_str(), kernel_name_size);
90  cache_file.write(reinterpret_cast<const char *>(binaries[0].data()), binaries[0].size());
91  }
92  cache_file.close();
93  }
94  else
95  {
96  ARM_COMPUTE_ERROR("Cannot open cache file");
97  }
98  }
99 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
std::string kernel_name

◆ scaled_3d_dimensions_signed()

std::tuple< int, int, int > scaled_3d_dimensions_signed ( int  width,
int  height,
int  depth,
int  kernel_width,
int  kernel_height,
int  kernel_depth,
const Pooling3dLayerInfo pool3d_info 
)

Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding mode.

Parameters
[in]widthWidth of input tensor
[in]heightHeight of input tensor
[in]depthDepth of input tensor
[in]kernel_widthKernel width.
[in]kernel_heightKernel height.
[in]kernel_depthKernel depth.
[in]pool3d_infoPad and stride and round information for 3d pooling
Returns
A tuple with the new width in the first position, the new height in the second, and the new depth in the third. Returned values can be < 1

Definition at line 492 of file Utils.cpp.

References ARM_COMPUTE_ERROR, Padding3D::back, Padding3D::bottom, CEIL, FLOOR, Padding3D::front, Padding3D::left, Pooling3dLayerInfo::padding, Padding3D::right, Pooling3dLayerInfo::round_type, Pooling3dLayerInfo::stride, Padding3D::top, arm_compute::test::validation::w, Size3D::x(), Size3D::y(), and Size3D::z().

Referenced by arm_compute::misc::shape_calculator::compute_pool3d_shape(), and permute_strides().

495 {
496  const int pad_left = pool3d_info.padding.left;
497  const int pad_top = pool3d_info.padding.top;
498  const int pad_right = pool3d_info.padding.right;
499  const int pad_bottom = pool3d_info.padding.bottom;
500  const int pad_front = pool3d_info.padding.front;
501  const int pad_back = pool3d_info.padding.back;
502  const int stride_x = pool3d_info.stride.x();
503  const int stride_y = pool3d_info.stride.y();
504  const int stride_z = pool3d_info.stride.z();
505  int w = 0;
506  int h = 0;
507  int d = 0;
508 
509  switch(pool3d_info.round_type)
510  {
511  case DimensionRoundingType::FLOOR:
512  w = static_cast<int>(std::floor((static_cast<float>(width + pad_left + pad_right - kernel_width) / stride_x) + 1));
513  h = static_cast<int>(std::floor((static_cast<float>(height + pad_top + pad_bottom - kernel_height) / stride_y) + 1));
514  d = static_cast<int>(std::floor((static_cast<float>(depth + pad_front + pad_back - kernel_depth) / stride_z) + 1));
515  break;
516  case DimensionRoundingType::CEIL:
517  w = static_cast<int>(std::ceil((static_cast<float>(width + pad_left + pad_right - kernel_width) / stride_x) + 1));
518  h = static_cast<int>(std::ceil((static_cast<float>(height + pad_top + pad_bottom - kernel_height) / stride_y) + 1));
519  d = static_cast<int>(std::ceil((static_cast<float>(depth + pad_front + pad_back - kernel_depth) / stride_z) + 1));
520  break;
521  default:
522  ARM_COMPUTE_ERROR("Unsupported rounding type");
523  }
524 
525  return std::make_tuple(static_cast<int>(w), static_cast<int>(h), static_cast<int>(d));
526 }
SimpleTensor< float > w
Definition: DFT.cpp:156
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ scaled_dimensions()

std::pair< unsigned int, unsigned int > scaled_dimensions ( int  width,
int  height,
int  kernel_width,
int  kernel_height,
const PadStrideInfo pad_stride_info,
const Size2D dilation = Size2D(1U, 1U) 
)

Returns expected width and height of output scaled tensor depending on dimensions rounding mode.

Parameters
[in]widthWidth of input tensor (Number of columns)
[in]heightHeight of input tensor (Number of rows)
[in]kernel_widthKernel width.
[in]kernel_heightKernel height.
[in]pad_stride_infoPad and stride information.
[in]dilation(Optional) Dilation, in elements, across x and y. Defaults to (1, 1).
Returns
A pair with the new width in the first position and the new height in the second.

Definition at line 429 of file Utils.cpp.

References ARM_COMPUTE_ERROR, CEIL, FLOOR, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), PadStrideInfo::round(), PadStrideInfo::stride(), arm_compute::test::validation::w, Size2D::x(), and Size2D::y().

Referenced by calculate_same_pad(), arm_compute::misc::shape_calculator::compute_deep_convolution_shape(), arm_compute::misc::shape_calculator::compute_depthwise_convolution_shape(), arm_compute::misc::shape_calculator::compute_im2col_conv_shape(), PoolingLayerNode::compute_output_descriptor(), FusedConvolutionBatchNormalizationWithPostOpsNode::compute_output_descriptor(), FusedConvolutionBatchNormalizationNode::compute_output_descriptor(), FusedDepthwiseConvolutionBatchNormalizationNode::compute_output_descriptor(), DepthwiseConvolutionLayerNode::compute_output_descriptor(), ConvolutionLayerNode::compute_output_descriptor(), FusedConvolutionWithPostOpNode::compute_output_descriptor(), arm_compute::misc::shape_calculator::compute_winograd_output_transform_shape(), ClIm2ColKernel::configure(), CpuIm2ColKernel::configure(), ClGemmConv2d::configure(), CpuGemmConv2d::configure(), arm_compute::test::validation::reference::convolution_layer_nchw(), CpuGemmConv2d::has_opt_impl(), arm_compute::test::validation::reference::im2col_nchw(), arm_compute::test::validation::reference::im2col_nhwc(), permute_strides(), ClGemmConv2d::validate(), and CpuGemmConv2d::validate().

433 {
434  const int dilation_x = dilation.x();
435  const int dilation_y = dilation.y();
436  const int pad_left = pad_stride_info.pad_left();
437  const int pad_top = pad_stride_info.pad_top();
438  const int pad_right = pad_stride_info.pad_right();
439  const int pad_bottom = pad_stride_info.pad_bottom();
440  const int stride_x = pad_stride_info.stride().first;
441  const int stride_y = pad_stride_info.stride().second;
442  int w = 0;
443  int h = 0;
444  switch(pad_stride_info.round())
445  {
446  case DimensionRoundingType::FLOOR:
447  w = static_cast<int>(std::floor((static_cast<float>(width + pad_left + pad_right - (dilation_x * (kernel_width - 1) + 1)) / stride_x) + 1));
448  h = static_cast<int>(std::floor((static_cast<float>(height + pad_top + pad_bottom - (dilation_y * (kernel_height - 1) + 1)) / stride_y) + 1));
449  break;
450  case DimensionRoundingType::CEIL:
451  w = static_cast<int>(std::ceil((static_cast<float>(width + pad_left + pad_right - (dilation_x * (kernel_width - 1) + 1)) / stride_x) + 1));
452  h = static_cast<int>(std::ceil((static_cast<float>(height + pad_top + pad_bottom - (dilation_y * (kernel_height - 1) + 1)) / stride_y) + 1));
453  break;
454  default:
455  ARM_COMPUTE_ERROR("Unsupported rounding type");
456  }
457 
458  w = std::max(1, w);
459  h = std::max(1, h);
460  return std::make_pair(static_cast<unsigned int>(w), static_cast<unsigned int>(h));
461 }
SimpleTensor< float > w
Definition: DFT.cpp:156
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ scaled_dimensions_signed()

std::pair< int, int > scaled_dimensions_signed ( int  width,
int  height,
int  kernel_width,
int  kernel_height,
const PadStrideInfo pad_stride_info 
)

Returns calculated width and height of output scaled tensor depending on dimensions rounding mode.

Parameters
[in]widthWidth of input tensor (Number of columns)
[in]heightHeight of input tensor (Number of rows)
[in]kernel_widthKernel width.
[in]kernel_heightKernel height.
[in]pad_stride_infoPad and stride information.
Returns
A pair with the new width in the first position and the new height in the second, returned values can be < 1

Definition at line 463 of file Utils.cpp.

References ARM_COMPUTE_ERROR, CEIL, FLOOR, PadStrideInfo::pad_bottom(), PadStrideInfo::pad_left(), PadStrideInfo::pad_right(), PadStrideInfo::pad_top(), PadStrideInfo::round(), PadStrideInfo::stride(), and arm_compute::test::validation::w.

Referenced by arm_compute::misc::shape_calculator::compute_pool_shape(), and permute_strides().

466 {
467  const int pad_left = pad_stride_info.pad_left();
468  const int pad_top = pad_stride_info.pad_top();
469  const int pad_right = pad_stride_info.pad_right();
470  const int pad_bottom = pad_stride_info.pad_bottom();
471  const int stride_x = pad_stride_info.stride().first;
472  const int stride_y = pad_stride_info.stride().second;
473  int w = 0;
474  int h = 0;
475  switch(pad_stride_info.round())
476  {
477  case DimensionRoundingType::FLOOR:
478  w = static_cast<int>(std::floor((static_cast<float>(width + pad_left + pad_right - kernel_width) / stride_x) + 1));
479  h = static_cast<int>(std::floor((static_cast<float>(height + pad_top + pad_bottom - kernel_height) / stride_y) + 1));
480  break;
481  case DimensionRoundingType::CEIL:
482  w = static_cast<int>(std::ceil((static_cast<float>(width + pad_left + pad_right - kernel_width) / stride_x) + 1));
483  h = static_cast<int>(std::ceil((static_cast<float>(height + pad_top + pad_bottom - kernel_height) / stride_y) + 1));
484  break;
485  default:
486  ARM_COMPUTE_ERROR("Unsupported rounding type");
487  }
488 
489  return std::make_pair(static_cast<int>(w), static_cast<int>(h));
490 }
SimpleTensor< float > w
Definition: DFT.cpp:156
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ schedule_kernel_on_ctx()

void schedule_kernel_on_ctx ( CLRuntimeContext ctx,
ICLKernel kernel,
bool  flush = true 
)

Schedules a kernel using the context if not nullptr else uses the legacy scheduling flow.

Parameters
[in]ctxContext to use.
[in]kernelKernel to schedule.
[in]flush(Optional) Specifies if the command queue will be flushed after running the kernel.

Definition at line 143 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_ERROR_ON_NULLPTR, CLScheduler::enqueue(), CLScheduler::get(), and CLRuntimeContext::gpu_scheduler().

Referenced by ICLSimpleFunction::run(), and CLInstanceNormalizationLayer::run().

144 {
146  if(ctx)
147  {
148  ARM_COMPUTE_ERROR_ON(ctx->gpu_scheduler() == nullptr);
149  ctx->gpu_scheduler()->enqueue(*kernel, flush);
150  }
151  else
152  {
153  CLScheduler::get().enqueue(*kernel, flush);
154  }
155 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
Definition: Validate.h:157

◆ select_preferable_platform()

cl::Platform select_preferable_platform ( CLBackendType  cl_backend_type)

This function selects the OpenCL platform based on the backend type.

Parameters
[in]cl_backend_typeThe OpenCL backend type to use.
Returns
A cl::Platform object.

Definition at line 88 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR, ARM_COMPUTE_ERROR_ON_MSG, Clvk, and Native.

Referenced by create_opencl_context_and_device().

89 {
90  std::vector<cl::Platform> platforms;
91  cl::Platform::get(&platforms);
92  ARM_COMPUTE_ERROR_ON_MSG(platforms.size() == 0, "Couldn't find any OpenCL platform");
93 
94  cl::Platform selected_platform{ nullptr };
95 
96  // If the user has selected the Native platform, return the first available.
97  switch(cl_backend_type)
98  {
99  case CLBackendType::Native:
100  selected_platform = platforms[0];
101  break;
102  case CLBackendType::Clvk:
103  for(auto p : platforms)
104  {
105  std::string res = p.getInfo<CL_PLATFORM_NAME>();
106  if(res.find("clvk") != std::string::npos)
107  {
108  selected_platform = p;
109  break;
110  }
111  }
112  break;
113  default:
114  ARM_COMPUTE_ERROR("Unsupported backend type");
115  }
116 
117  if(!selected_platform())
118  {
119  ARM_COMPUTE_ERROR("No valid platform found");
120  }
121 
122  return selected_platform;
123 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
Definition: Error.h:456

◆ set_data_layout_if_unknown()

bool arm_compute::set_data_layout_if_unknown ( ITensorInfo info,
DataLayout  data_layout 
)
inline

Set the data layout to the specified value if the current data layout is unknown.

Parameters
[in,out]infoTensor info used to check and assign.
[in]data_layoutNew data layout.
Returns
True if the data type has been changed.

Definition at line 145 of file AutoConfiguration.h.

References ITensorInfo::data_layout(), ITensorInfo::set_data_layout(), and UNKNOWN.

146 {
148  {
149  info.set_data_layout(data_layout);
150  return true;
151  }
152 
153  return false;
154 }
Unknown CL kernel type.
Definition: CLTypes.h:82
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
DataLayout data_layout
Data layout to use.

◆ set_data_type_if_unknown()

bool arm_compute::set_data_type_if_unknown ( ITensorInfo info,
DataType  data_type 
)
inline

Set the data type and number of channels to the specified value if the current data type is unknown.

Parameters
[in,out]infoTensor info used to check and assign.
[in]data_typeNew data type.
Returns
True if the data type has been changed.

Definition at line 126 of file AutoConfiguration.h.

References ITensorInfo::data_type(), ITensorInfo::set_data_type(), and UNKNOWN.

Referenced by NELogicalKernel::configure(), CpuSubKernel::configure(), and CpuAddKernel::configure().

127 {
128  if(info.data_type() == DataType::UNKNOWN)
129  {
130  info.set_data_type(data_type);
131  return true;
132  }
133 
134  return false;
135 }
Unknown CL kernel type.
Definition: CLTypes.h:82
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ set_format_if_unknown()

bool arm_compute::set_format_if_unknown ( ITensorInfo info,
Format  format 
)
inline

Set the format, data type and number of channels to the specified value if the current data type is unknown.

Parameters
[in,out]infoTensor info used to check and assign.
[in]formatNew format.
Returns
True if the format has been changed.

Definition at line 107 of file AutoConfiguration.h.

References ITensorInfo::data_type(), ITensorInfo::set_format(), and UNKNOWN.

Referenced by NEBitwiseNotKernel::configure(), NEBitwiseXorKernel::configure(), NEBitwiseOrKernel::configure(), and NEBitwiseAndKernel::configure().

108 {
109  if(info.data_type() == DataType::UNKNOWN)
110  {
111  info.set_format(format);
112  return true;
113  }
114 
115  return false;
116 }
Unknown CL kernel type.
Definition: CLTypes.h:82
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ set_quantization_info_if_empty()

bool arm_compute::set_quantization_info_if_empty ( ITensorInfo info,
QuantizationInfo  quantization_info 
)
inline

Set the quantization info to the specified value if the current quantization info is empty and the data type of asymmetric quantized type.

Parameters
[in,out]infoTensor info used to check and assign.
[in]quantization_infoQuantization info
Returns
True if the quantization info has been changed.

Definition at line 164 of file AutoConfiguration.h.

References ITensorInfo::data_type(), QuantizationInfo::empty(), is_data_type_quantized_asymmetric(), ITensorInfo::quantization_info(), and ITensorInfo::set_quantization_info().

165 {
166  if(info.quantization_info().empty() && (is_data_type_quantized_asymmetric(info.data_type())))
167  {
168  info.set_quantization_info(quantization_info);
169  return true;
170  }
171 
172  return false;
173 }
bool is_data_type_quantized_asymmetric(DataType dt)
Check if a given data type is of asymmetric quantized type.
Definition: Utils.h:1052
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ set_shape_if_empty()

bool arm_compute::set_shape_if_empty ( ITensorInfo info,
const TensorShape shape 
)
inline

Set the shape to the specified value if the current assignment is empty.

Parameters
[in,out]infoTensor info used to check and assign.
[in]shapeNew shape.
Returns
True if the shape has been changed.

Definition at line 88 of file AutoConfiguration.h.

References ITensorInfo::set_tensor_shape(), ITensorInfo::tensor_shape(), and TensorShape::total_size().

Referenced by NELogicalKernel::configure(), NEBitwiseNotKernel::configure(), NEBitwiseXorKernel::configure(), CpuSubKernel::configure(), NEBitwiseAndKernel::configure(), NEBitwiseOrKernel::configure(), ClCastKernel::configure(), CpuCastKernel::configure(), CpuAddKernel::configure(), and CpuMulKernel::configure().

89 {
90  if(info.tensor_shape().total_size() == 0)
91  {
92  info.set_tensor_shape(shape);
93  return true;
94  }
95 
96  return false;
97 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ set_unroll_with_pragma()

void set_unroll_with_pragma ( CLBuildOptions built_opts,
std::initializer_list< int >  values 
)

Definition at line 482 of file CLHelpers.cpp.

References CLBuildOptions::add_option().

Referenced by CLDepthwiseConvolutionLayerNativeKernel::configure().

483 {
484  for(const int value : values)
485  {
486  if(value > max_manual_loop_unrolling)
487  {
488  built_opts.add_option("-DUNROLL_WITH_PRAGMA");
489  return;
490  }
491  }
492 }

◆ set_wbsm()

void set_wbsm ( cl::Kernel &  kernel,
cl_int  wbsm_hint 
)

Definition at line 434 of file CLHelpers.cpp.

References ARM_COMPUTE_ERROR_ON, ARM_COMPUTE_UNUSED, and clSetKernelExecInfo().

Referenced by enqueue().

435 {
436  cl_int err = clSetKernelExecInfo(kernel.get(),
437  CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM,
438  sizeof(cl_int),
439  &wbsm_hint);
440  ARM_COMPUTE_UNUSED(err);
441  ARM_COMPUTE_ERROR_ON(err != CL_SUCCESS);
442 }
cl_int clSetKernelExecInfo(cl_kernel kernel, cl_kernel_exec_info param_name, size_t param_value_size, const void *param_value)
Definition: OpenCL.cpp:1054
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152

◆ string_from_activation_func()

const std::string & string_from_activation_func ( ActivationLayerInfo::ActivationFunction  act)

Translates a given activation function to a string.

Parameters
[in]actActivationLayerInfo::ActivationFunction to be translated to string.
Returns
The string describing the activation function.

Definition at line 163 of file Utils.cpp.

References ActivationLayerInfo::ABS, ActivationLayerInfo::BOUNDED_RELU, ActivationLayerInfo::ELU, ActivationLayerInfo::GELU, ActivationLayerInfo::HARD_SWISH, ActivationLayerInfo::IDENTITY, ActivationLayerInfo::LEAKY_RELU, ActivationLayerInfo::LINEAR, ActivationLayerInfo::LOGISTIC, ActivationLayerInfo::LU_BOUNDED_RELU, ActivationLayerInfo::RELU, ActivationLayerInfo::SOFT_RELU, ActivationLayerInfo::SQRT, ActivationLayerInfo::SQUARE, ActivationLayerInfo::SWISH, and ActivationLayerInfo::TANH.

Referenced by ClElementwiseKernel::ClElementwiseKernel(), ClActivationKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), ClWinogradOutputTransformKernel::configure(), ClDirectConv2dKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLBatchNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), ClComplexMulKernel::configure(), permute_strides(), and PostOpCLKernelUtils::set_post_ops_cl_build_options().

164 {
165  static std::map<ActivationLayerInfo::ActivationFunction, const std::string> act_map =
166  {
167  { ActivationLayerInfo::ActivationFunction::ABS, "ABS" },
168  { ActivationLayerInfo::ActivationFunction::LINEAR, "LINEAR" },
169  { ActivationLayerInfo::ActivationFunction::LOGISTIC, "LOGISTIC" },
170  { ActivationLayerInfo::ActivationFunction::RELU, "RELU" },
171  { ActivationLayerInfo::ActivationFunction::BOUNDED_RELU, "BRELU" },
172  { ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, "LU_BRELU" },
173  { ActivationLayerInfo::ActivationFunction::LEAKY_RELU, "LRELU" },
174  { ActivationLayerInfo::ActivationFunction::SOFT_RELU, "SRELU" },
175  { ActivationLayerInfo::ActivationFunction::ELU, "ELU" },
176  { ActivationLayerInfo::ActivationFunction::SQRT, "SQRT" },
177  { ActivationLayerInfo::ActivationFunction::SQUARE, "SQUARE" },
178  { ActivationLayerInfo::ActivationFunction::TANH, "TANH" },
179  { ActivationLayerInfo::ActivationFunction::IDENTITY, "IDENTITY" },
180  { ActivationLayerInfo::ActivationFunction::HARD_SWISH, "HARD_SWISH" },
181  { ActivationLayerInfo::ActivationFunction::SWISH, "SWISH" },
182  { ActivationLayerInfo::ActivationFunction::GELU, "GELU" }
183 
184  };
185 
186  return act_map[act];
187 }

◆ string_from_border_mode()

const std::string & string_from_border_mode ( BorderMode  border_mode)

Translates a given border mode policy to a string.

Parameters
[in]border_modeBorderMode to be translated to string.
Returns
The string describing the border mode.

Definition at line 201 of file Utils.cpp.

References CONSTANT, REPLICATE, and UNDEFINED.

Referenced by CLFillBorderKernel::configure(), and permute_strides().

202 {
203  static std::map<BorderMode, const std::string> border_mode_map =
204  {
205  { BorderMode::UNDEFINED, "UNDEFINED" },
206  { BorderMode::CONSTANT, "CONSTANT" },
207  { BorderMode::REPLICATE, "REPLICATE" },
208  };
209 
210  return border_mode_map[border_mode];
211 }

◆ string_from_channel()

const std::string & string_from_channel ( Channel  channel)

Convert a channel identity into a string.

Parameters
[in]channelChannel to be translated to string.
Returns
The string describing the channel.

Definition at line 102 of file Utils.cpp.

References A, B, C0, C1, C2, C3, G, R, U, UNKNOWN, V, and Y.

Referenced by permute_strides().

103 {
104  static std::map<Channel, const std::string> channels_map =
105  {
106  { Channel::UNKNOWN, "UNKNOWN" },
107  { Channel::R, "R" },
108  { Channel::G, "G" },
109  { Channel::B, "B" },
110  { Channel::A, "A" },
111  { Channel::Y, "Y" },
112  { Channel::U, "U" },
113  { Channel::V, "V" },
114  { Channel::C0, "C0" },
115  { Channel::C1, "C1" },
116  { Channel::C2, "C2" },
117  { Channel::C3, "C3" }
118  };
119 
120  return channels_map[channel];
121 }
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ string_from_data_layout()

const std::string & string_from_data_layout ( DataLayout  dl)

Convert a data layout identity into a string.

Parameters
[in]dlDataLayout to be translated to string.
Returns
The string describing the data layout.

Definition at line 123 of file Utils.cpp.

References dl, NCHW, NHWC, and UNKNOWN.

Referenced by ClScaleKernel::configure(), ClPool3dKernel::configure(), ClPool2dKernel::configure(), CpuScaleKernel::configure(), ClWinogradFilterTransformKernel::configure(), ClWinogradInputTransformKernel::configure(), CLChannelShuffleLayerKernel::configure(), CLDepthToSpaceLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), CLBatchToSpaceLayerKernel::configure(), CLSpaceToDepthLayerKernel::configure(), CLSpaceToBatchLayerKernel::configure(), CLNormalizationLayerKernel::configure(), CLComparisonKernel::configure(), CLReorgLayerKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), ClDirectConv2dKernel::configure(), ClIm2ColKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), error_on_data_layout_not_in(), ClFloorKernelComponent::generate_config_id(), ClElementwiseKernelComponent::generate_config_id(), ClTemplateDirectConv2d::get_config_id(), operator<<(), permute_strides(), and ClSaturatedArithmeticKernel::validate().

124 {
125  static std::map<DataLayout, const std::string> dl_map =
126  {
127  { DataLayout::UNKNOWN, "UNKNOWN" },
128  { DataLayout::NCHW, "NCHW" },
129  { DataLayout::NHWC, "NHWC" },
130  };
131 
132  return dl_map[dl];
133 }
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ string_from_data_type()

const std::string & string_from_data_type ( DataType  dt)

Convert a data type identity into a string.

Parameters
[in]dtDataType to be translated to string.
Returns
The string describing the data type.

Definition at line 135 of file Utils.cpp.

References dt, F16, F32, F64, QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8, QSYMM8_PER_CHANNEL, S16, S32, S64, S8, SIZET, U16, U32, U64, U8, and UNKNOWN.

Referenced by CpuQuantizeKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClPool2dKernel::configure(), ClPool3dKernel::configure(), ClActivationKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), CLStridedSliceKernel::configure(), ClGemmReshapeLhsMatrixKernel::configure(), ClGemmMatrixMultiplyNativeKernel::configure(), CLMaxUnpoolingLayerKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsMMULKernel::configure(), CpuScaleKernel::configure(), CLReverseKernel::configure(), CLSelectKernel::configure(), CLChannelShuffleLayerKernel::configure(), ClWinogradOutputTransformKernel::configure(), ClCastKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLFFTScaleKernel::configure(), CLNormalizationLayerKernel::configure(), CLTileKernel::configure(), CLComparisonKernel::configure(), CLReorgLayerKernel::configure(), CLFFTDigitReverseKernel::configure(), CLMeanStdDevNormalizationKernel::configure(), ClDirectConv2dKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLRangeKernel::configure(), ClCol2ImKernel::configure(), CLFFTRadixStageKernel::configure(), ClDirectConv3dKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), ClGemmMatrixMultiplyReshapedOnlyRhsKernel::configure(), CLFillBorderKernel::configure(), ClIm2ColKernel::configure(), CLDeconvolutionReshapeOutputKernel::configure(), CLBatchNormalizationLayerKernel::configure(), ClGemmMatrixMultiplyReshapedKernel::configure(), error_on_data_type_not_in(), ClFloorKernelComponent::generate_config_id(), ClElementwiseKernelComponent::generate_config_id(), ClTemplateDirectConv2d::get_config_id(), operator<<(), and permute_strides().

136 {
137  static std::map<DataType, const std::string> dt_map =
138  {
139  { DataType::UNKNOWN, "UNKNOWN" },
140  { DataType::S8, "S8" },
141  { DataType::U8, "U8" },
142  { DataType::S16, "S16" },
143  { DataType::U16, "U16" },
144  { DataType::S32, "S32" },
145  { DataType::U32, "U32" },
146  { DataType::S64, "S64" },
147  { DataType::U64, "U64" },
148  { DataType::F16, "F16" },
149  { DataType::F32, "F32" },
150  { DataType::F64, "F64" },
151  { DataType::SIZET, "SIZET" },
152  { DataType::QSYMM8, "QSYMM8" },
153  { DataType::QSYMM8_PER_CHANNEL, "QSYMM8_PER_CHANNEL" },
154  { DataType::QASYMM8, "QASYMM8" },
155  { DataType::QASYMM8_SIGNED, "QASYMM8_SIGNED" },
156  { DataType::QSYMM16, "QSYMM16" },
157  { DataType::QASYMM16, "QASYMM16" },
158  };
159 
160  return dt_map[dt];
161 }
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ string_from_format()

const std::string & string_from_format ( Format  format)

Convert a tensor format into a string.

Parameters
[in]formatFormat to be translated to string.
Returns
The string describing the format.

Definition at line 76 of file Utils.cpp.

References F16, F32, IYUV, NV12, NV21, RGB888, RGBA8888, S16, S32, U16, U32, U8, UNKNOWN, UV88, UYVY422, YUV444, and YUYV422.

Referenced by error_on_format_not_in(), and permute_strides().

77 {
78  static std::map<Format, const std::string> formats_map =
79  {
80  { Format::UNKNOWN, "UNKNOWN" },
81  { Format::U8, "U8" },
82  { Format::S16, "S16" },
83  { Format::U16, "U16" },
84  { Format::S32, "S32" },
85  { Format::U32, "U32" },
86  { Format::F16, "F16" },
87  { Format::F32, "F32" },
88  { Format::UV88, "UV88" },
89  { Format::RGB888, "RGB888" },
90  { Format::RGBA8888, "RGBA8888" },
91  { Format::YUV444, "YUV444" },
92  { Format::YUYV422, "YUYV422" },
93  { Format::NV12, "NV12" },
94  { Format::NV21, "NV21" },
95  { Format::IYUV, "IYUV" },
96  { Format::UYVY422, "UYVY422" }
97  };
98 
99  return formats_map[format];
100 }
Unknown CL kernel type.
Definition: CLTypes.h:82

◆ string_from_gemmlowp_output_stage()

const std::string & string_from_gemmlowp_output_stage ( GEMMLowpOutputStageType  output_stage)

Translates a given GEMMLowp output stage to a string.

Parameters
[in]output_stageGEMMLowpOutputStageInfo to be translated to string.
Returns
The string describing the GEMMLowp output stage

Definition at line 262 of file Utils.cpp.

References NONE, output_stage, QUANTIZE_DOWN, QUANTIZE_DOWN_FIXEDPOINT, and QUANTIZE_DOWN_FLOAT.

Referenced by ClGemmLowpOffsetContributionOutputStageKernel::configure(), and is_symmetric().

263 {
264  static std::map<GEMMLowpOutputStageType, const std::string> output_stage_map =
265  {
266  { GEMMLowpOutputStageType::NONE, "" },
267  { GEMMLowpOutputStageType::QUANTIZE_DOWN, "quantize_down" },
268  { GEMMLowpOutputStageType::QUANTIZE_DOWN_FIXEDPOINT, "quantize_down_fixedpoint" },
269  { GEMMLowpOutputStageType::QUANTIZE_DOWN_FLOAT, "quantize_down_float" }
270  };
271 
272  return output_stage_map[output_stage];
273 }
const OutputStage & output_stage

◆ string_from_interpolation_policy()

const std::string & string_from_interpolation_policy ( InterpolationPolicy  policy)

Translates a given interpolation policy to a string.

Parameters
[in]policyInterpolationPolicy to be translated to string.
Returns
The string describing the interpolation policy.

Definition at line 189 of file Utils.cpp.

References AREA, BILINEAR, and NEAREST_NEIGHBOR.

Referenced by ClScaleKernel::configure(), CpuScaleKernel::configure(), and permute_strides().

190 {
191  static std::map<InterpolationPolicy, const std::string> interpolation_policy_map =
192  {
193  { InterpolationPolicy::AREA, "AREA" },
194  { InterpolationPolicy::BILINEAR, "BILINEAR" },
195  { InterpolationPolicy::NEAREST_NEIGHBOR, "NEAREST_NEIGHBOUR" },
196  };
197 
198  return interpolation_policy_map[policy];
199 }

◆ string_from_norm_type()

const std::string & string_from_norm_type ( NormType  type)

Translates a given normalization type to a string.

Parameters
[in]typeNormType to be translated to string.
Returns
The string describing the normalization type.

Definition at line 213 of file Utils.cpp.

References CROSS_MAP, IN_MAP_1D, IN_MAP_2D, and type.

Referenced by permute_strides().

214 {
215  static std::map<NormType, const std::string> norm_type_map =
216  {
217  { NormType::IN_MAP_1D, "IN_MAP_1D" },
218  { NormType::IN_MAP_2D, "IN_MAP_2D" },
219  { NormType::CROSS_MAP, "CROSS_MAP" },
220  };
221 
222  return norm_type_map[type];
223 }
decltype(strategy::transforms) typedef type

◆ string_from_pixel_value()

std::string string_from_pixel_value ( const PixelValue value,
const DataType  data_type 
)

Convert a PixelValue to a string, represented through the specific data type.

Parameters
[in]valueThe PixelValue to convert
[in]data_typeThe type to be used to convert the value
Returns
String representation of the PixelValue through the given data type.

Definition at line 275 of file Utils.cpp.

References ARM_COMPUTE_ERROR, F16, F32, float_to_string_with_full_precision(), PixelValue::get(), QASYMM16, QASYMM8, QASYMM8_SIGNED, QSYMM16, QSYMM8_PER_CHANNEL, S16, S32, S8, arm_compute::test::validation::ss(), U16, U32, and U8.

Referenced by ClFillKernel::configure(), ClScaleKernel::configure(), CLPadLayerKernel::configure(), and is_symmetric().

276 {
277  std::stringstream ss;
278  std::string converted_string;
279 
280  switch(data_type)
281  {
282  case DataType::U8:
283  case DataType::QASYMM8:
284  // Needs conversion to 32 bit, otherwise interpreted as ASCII values
285  ss << uint32_t(value.get<uint8_t>());
286  converted_string = ss.str();
287  break;
288  case DataType::S8:
289  case DataType::QASYMM8_SIGNED:
290  case DataType::QSYMM8_PER_CHANNEL:
291  // Needs conversion to 32 bit, otherwise interpreted as ASCII values
292  ss << int32_t(value.get<int8_t>());
293  converted_string = ss.str();
294  break;
295  case DataType::U16:
296  case DataType::QASYMM16:
297  ss << value.get<uint16_t>();
298  converted_string = ss.str();
299  break;
300  case DataType::S16:
301  case DataType::QSYMM16:
302  ss << value.get<int16_t>();
303  converted_string = ss.str();
304  break;
305  case DataType::U32:
306  ss << value.get<uint32_t>();
307  converted_string = ss.str();
308  break;
309  case DataType::S32:
310  ss << value.get<int32_t>();
311  converted_string = ss.str();
312  break;
313  case DataType::F32:
314  converted_string = float_to_string_with_full_precision(value.get<float>());
315  break;
316  case DataType::F16:
317  static_assert(sizeof(half) == 2, "Half must be 16 bit");
318  ss << value.get<half>();
319  converted_string = ss.str();
320  break;
321  default:
322  ARM_COMPUTE_ERROR("Not handled");
323  }
324 
325  return converted_string;
326 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352
half_float::half half
16-bit floating point type
Definition: Types.h:48
std::stringstream ss(mlgo_str)
std::string float_to_string_with_full_precision(float val)
Create a string with the float in full precision.
Definition: Utils.h:1124

◆ string_from_pooling_type()

const std::string & string_from_pooling_type ( PoolingType  type)

Translates a given pooling type to a string.

Parameters
[in]typePoolingType to be translated to string.
Returns
The string describing the pooling type.

Definition at line 225 of file Utils.cpp.

References AVG, L2, MAX, and type.

Referenced by ClPool2dKernel::configure(), ClPool3dKernel::configure(), and permute_strides().

226 {
227  static std::map<PoolingType, const std::string> pool_type_map =
228  {
229  { PoolingType::MAX, "MAX" },
230  { PoolingType::AVG, "AVG" },
231  { PoolingType::L2, "L2" },
232  };
233 
234  return pool_type_map[type];
235 }
#define MAX(x, y)
decltype(strategy::transforms) typedef type

◆ string_from_target()

const std::string & string_from_target ( GPUTarget  target)

Translates a given gpu device target to string.

Parameters
[in]targetGiven gpu target.
Returns
The string describing the target.

Definition at line 151 of file GPUTarget.cpp.

References BIFROST, G31, G310, G51, G510, G51BIG, G51LIT, G52, G52LIT, G57, G610, G615, G68, G71, G710, G715, G72, G76, G77, G78, G78AE, MIDGARD, T600, T700, T800, and VALHALL.

Referenced by arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_native(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_reshaped(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_reshaped_only_rhs(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_kernel(), and CLTuner::tune_kernel_dynamic().

152 {
153  static std::map<GPUTarget, const std::string> gpu_target_map =
154  {
155  { GPUTarget::MIDGARD, "midgard" },
156  { GPUTarget::BIFROST, "bifrost" },
157  { GPUTarget::VALHALL, "valhall" },
158  { GPUTarget::T600, "t600" },
159  { GPUTarget::T700, "t700" },
160  { GPUTarget::T800, "t800" },
161  { GPUTarget::G71, "g71" },
162  { GPUTarget::G72, "g72" },
163  { GPUTarget::G51, "g51" },
164  { GPUTarget::G51BIG, "g51big" },
165  { GPUTarget::G51LIT, "g51lit" },
166  { GPUTarget::G31, "g31" },
167  { GPUTarget::G76, "g76" },
168  { GPUTarget::G52, "g52" },
169  { GPUTarget::G52LIT, "g52lit" },
170  { GPUTarget::G77, "g77" },
171  { GPUTarget::G57, "g57" },
172  { GPUTarget::G78, "g78" },
173  { GPUTarget::G68, "g68" },
174  { GPUTarget::G78AE, "g78ae" },
175  { GPUTarget::G710, "g710" },
176  { GPUTarget::G610, "g610" },
177  { GPUTarget::G510, "g510" },
178  { GPUTarget::G310, "g310" },
179  { GPUTarget::G715, "g715" },
180  { GPUTarget::G615, "g615" },
181  };
182 
183  return gpu_target_map[target];
184 }

◆ swap()

void arm_compute::swap ( Window lhs,
Window rhs 
)
inline
Parameters
[in]lhsFirst window to swap.
[in]rhsSecond window to swap.

Definition at line 304 of file Window.inl.

Referenced by CaffePreproccessor::CaffePreproccessor(), and PostOpList< arm_compute::ITensorInfo *>::operator=().

305 {
306  lhs._dims.swap(rhs._dims);
307 }

◆ throw_error()

void throw_error ( Status  err)

Throw an std::runtime_error.

Parameters
[in]errError status

Definition at line 46 of file Error.cpp.

References ARM_COMPUTE_THROW, and Status::error_description().

Referenced by Status::throw_if_error().

47 {
48  ARM_COMPUTE_THROW(std::runtime_error(err.error_description()));
49 }
#define ARM_COMPUTE_THROW(ex)
Definition: Error.h:480
std::string error_description() const
Gets error description if any.
Definition: Error.h:97

◆ to_string() [1/91]

std::string arm_compute::to_string ( const T &  val)
inline

Fallback method: try to use std::to_string:

Parameters
[in]valValue to convert to string
Returns
String representing val.

Definition at line 80 of file TypePrinter.h.

References arm_compute::support::cpp11::to_string().

Referenced by arm_compute::graph::backends::detail::create_batch_normalization_layer(), arm_compute::graph::backends::detail::create_convolution_layer(), arm_compute::graph::backends::detail::create_depthwise_convolution_layer(), arm_compute::graph::backends::detail::create_fused_convolution_batch_normalization_layer(), arm_compute::graph::backends::detail::create_fused_convolution_with_post_op(), arm_compute::graph::backends::detail::create_fused_depthwise_convolution_batch_normalization_layer(), InitializerListDataset< T >::iterator::description(), logParamsImpl(), arm_compute::test::framework::make_printable(), operator<<(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_native(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_reshaped(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_config_reshaped_only_rhs(), arm_compute::cl_gemm::auto_heuristics::select_mlgo_gemm_kernel(), to_string(), to_string_if_not_null(), and DotGraphVisitor::visit().

81 {
82  return support::cpp11::to_string(val);
83 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ to_string() [2/91]

std::string arm_compute::to_string ( const std::vector< T > &  args)

Formatted output of a vector of objects.

Parameters
[in]argsVector of objects to print
Returns
String representing args.

Definition at line 134 of file TypePrinter.h.

References GemmTuner::args, and caffe_mnist_image_extractor::str.

135 {
136  std::stringstream str;
137  str << args;
138  return str.str();
139 }

◆ to_string() [3/91]

std::string arm_compute::to_string ( experimental::PostOpType  post_op_type)
inline

Converts a experimental::PostOpType to string.

Parameters
[in]post_op_typePostOpType value to be converted
Returns
String representing the corresponding PostOpType

Definition at line 185 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

186 {
187  std::stringstream str;
188  str << post_op_type;
189  return str.str();
190 }

◆ to_string() [4/91]

std::string arm_compute::to_string ( const experimental::IPostOp< T > &  post_op)
inline

Converts an experimental::IPostOp to string.

Parameters
[in]post_opIPostOp value to be converted
Returns
String representing the corresponding IPostOp

Definition at line 240 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

241 {
242  std::stringstream str;
243  str << post_op;
244  return str.str();
245 }

◆ to_string() [5/91]

std::string arm_compute::to_string ( const experimental::PostOpList< T > &  post_ops)
inline

Converts a experimental::PostOpList to string.

Parameters
[in]post_opsPostOpList value to be converted
Returns
String representing the corresponding PostOpList

Definition at line 271 of file TypePrinter.h.

References arm_compute::test::validation::post_ops, and caffe_mnist_image_extractor::str.

272 {
273  std::stringstream str;
274  str << post_ops;
275  return str.str();
276 }
experimental::PostOpList< ITensorInfo * > post_ops

◆ to_string() [6/91]

std::string arm_compute::to_string ( const ROIPoolingLayerInfo pool_info)
inline

Formatted output of the ROIPoolingInfo type.

Parameters
[in]pool_infoType to output.
Returns
Formatted string.

Definition at line 363 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

364 {
365  std::stringstream str;
366  str << pool_info;
367  return str.str();
368 }

◆ to_string() [7/91]

std::string arm_compute::to_string ( const GEMMRHSMatrixInfo gemm_info)
inline

Formatted output of the GEMMRHSMatrixInfo type.

Parameters
[in]gemm_infoGEMMRHSMatrixInfo to output.
Returns
Formatted string.

Definition at line 428 of file TypePrinter.h.

References arm_compute::test::validation::gemm_info, and caffe_mnist_image_extractor::str.

429 {
430  std::stringstream str;
431  str << gemm_info;
432  return str.str();
433 }

◆ to_string() [8/91]

std::string arm_compute::to_string ( const GEMMLHSMatrixInfo gemm_info)
inline

Formatted output of the GEMMLHSMatrixInfo type.

Parameters
[in]gemm_infoGEMMLHSMatrixInfo to output.
Returns
Formatted string.

Definition at line 441 of file TypePrinter.h.

References arm_compute::test::validation::gemm_info, and caffe_mnist_image_extractor::str.

442 {
443  std::stringstream str;
444  str << gemm_info;
445  return str.str();
446 }

◆ to_string() [9/91]

std::string arm_compute::to_string ( const GEMMKernelInfo gemm_info)
inline

Formatted output of the GEMMKernelInfo type.

Parameters
[in]gemm_infoGEMMKernelInfo Type to output.
Returns
Formatted string.

Definition at line 454 of file TypePrinter.h.

References arm_compute::test::validation::gemm_info, and caffe_mnist_image_extractor::str.

455 {
456  std::stringstream str;
457  str << gemm_info;
458  return str.str();
459 }

◆ to_string() [10/91]

std::string arm_compute::to_string ( const BoundingBoxTransformInfo bbox_info)
inline

Formatted output of the BoundingBoxTransformInfo type.

Parameters
[in]bbox_infoType to output.
Returns
Formatted string.

Definition at line 492 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

493 {
494  std::stringstream str;
495  str << bbox_info;
496  return str.str();
497 }

◆ to_string() [11/91]

std::string arm_compute::to_string ( const ComputeAnchorsInfo anchors_info)
inline

Formatted output of the ComputeAnchorsInfo type.

Parameters
[in]anchors_infoType to output.
Returns
Formatted string.

Definition at line 518 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

519 {
520  std::stringstream str;
521  str << anchors_info;
522  return str.str();
523 }

◆ to_string() [12/91]

std::string arm_compute::to_string ( const GenerateProposalsInfo proposals_info)
inline

Formatted output of the GenerateProposalsInfo type.

Parameters
[in]proposals_infoType to output.
Returns
Formatted string.

Definition at line 544 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

545 {
546  std::stringstream str;
547  str << proposals_info;
548  return str.str();
549 }

◆ to_string() [13/91]

std::string arm_compute::to_string ( const QuantizationInfo quantization_info)
inline

Formatted output of the QuantizationInfo type.

Parameters
[in]quantization_infoType to output.
Returns
Formatted string.

Definition at line 572 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

573 {
574  std::stringstream str;
575  str << quantization_info;
576  return str.str();
577 }

◆ to_string() [14/91]

std::string arm_compute::to_string ( const arm_compute::ActivationLayerInfo info)
inline

Formatted output of the activation function info type.

Parameters
[in]infoActivationLayerInfo to output.
Returns
Formatted string.

Definition at line 652 of file TypePrinter.h.

References ActivationLayerInfo::activation(), ActivationLayerInfo::enabled(), and caffe_mnist_image_extractor::str.

653 {
654  std::stringstream str;
655  if(info.enabled())
656  {
657  str << info.activation();
658  }
659  return str.str();
660 }
bool enabled() const
Check if initialised.
Definition: Types.h:1694
ActivationFunction activation() const
Get the type of activation function.
Definition: Types.h:1679

◆ to_string() [15/91]

std::string arm_compute::to_string ( const arm_compute::ActivationLayerInfo::ActivationFunction function)
inline

Formatted output of the activation function type.

Parameters
[in]functionType to output.
Returns
Formatted string.

Definition at line 699 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

700 {
701  std::stringstream str;
702  str << function;
703  return str.str();
704 }

◆ to_string() [16/91]

std::string arm_compute::to_string ( const arm_compute::NormalizationLayerInfo info)
inline

Formatted output of NormalizationLayerInfo.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 739 of file TypePrinter.h.

References NormalizationLayerInfo::norm_size(), caffe_mnist_image_extractor::str, and NormalizationLayerInfo::type().

740 {
741  std::stringstream str;
742  str << info.type() << ":NormSize=" << info.norm_size();
743  return str.str();
744 }
uint32_t norm_size() const
Get the normalization size.
Definition: Types.h:1870
NormType type() const
Get the normalization type.
Definition: Types.h:1865

◆ to_string() [17/91]

std::string arm_compute::to_string ( const RoundingPolicy rounding_policy)
inline

Formatted output of RoundingPolicy.

Parameters
[in]rounding_policyType to output.
Returns
Formatted string.

Definition at line 806 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

807 {
808  std::stringstream str;
809  str << rounding_policy;
810  return str.str();
811 }

◆ to_string() [18/91]

std::string arm_compute::to_string ( const arm_compute::DataLayout data_layout)
inline

Formatted output of the DataLayout type.

Parameters
[in]data_layoutType to output.
Returns
Formatted string.

Definition at line 853 of file TypePrinter.h.

References arm_compute::test::validation::data_layout, and caffe_mnist_image_extractor::str.

854 {
855  std::stringstream str;
856  str << data_layout;
857  return str.str();
858 }

◆ to_string() [19/91]

std::string arm_compute::to_string ( const arm_compute::DataType data_type)
inline

Formatted output of the DataType type.

Parameters
[in]data_typeType to output.
Returns
Formatted string.

Definition at line 977 of file TypePrinter.h.

References arm_compute::test::validation::data_type, and caffe_mnist_image_extractor::str.

978 {
979  std::stringstream str;
980  str << data_type;
981  return str.str();
982 }

◆ to_string() [20/91]

std::string arm_compute::to_string ( const Format format)
inline

Formatted output of the Format type.

Parameters
[in]formatType to output.
Returns
Formatted string.

Definition at line 1059 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1060 {
1061  std::stringstream str;
1062  str << format;
1063  return str.str();
1064 }

◆ to_string() [21/91]

std::string arm_compute::to_string ( const Channel channel)
inline

Formatted output of the Channel type.

Parameters
[in]channelType to output.
Returns
Formatted string.

Definition at line 1126 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1127 {
1128  std::stringstream str;
1129  str << channel;
1130  return str.str();
1131 }

◆ to_string() [22/91]

std::string arm_compute::to_string ( const TensorInfo info)
inline

Formatted output of the const TensorInfo& type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1315 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1316 {
1317  std::stringstream str;
1318  str << &info;
1319  return str.str();
1320 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [23/91]

std::string arm_compute::to_string ( const ITensorInfo info)
inline

Formatted output of the const ITensorInfo& type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1328 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1329 {
1330  std::stringstream str;
1331  str << &info;
1332  return str.str();
1333 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [24/91]

std::string arm_compute::to_string ( const ITensorInfo info)
inline

Formatted output of the const ITensorInfo* type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1341 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1342 {
1343  std::string ret_str = "nullptr";
1344  if(info != nullptr)
1345  {
1346  std::stringstream str;
1347  str << info;
1348  ret_str = str.str();
1349  }
1350  return ret_str;
1351 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [25/91]

std::string arm_compute::to_string ( ITensorInfo info)
inline

Formatted output of the ITensorInfo* type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1359 of file TypePrinter.h.

References to_string().

1360 {
1361  return to_string(static_cast<const ITensorInfo *>(info));
1362 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [26/91]

std::string arm_compute::to_string ( const ITensor tensor)
inline

Formatted output of the ITensorInfo type obtained from const ITensor* type.

Parameters
[in]tensorType to output.
Returns
Formatted string.

Definition at line 1370 of file TypePrinter.h.

References ITensor::info(), and caffe_mnist_image_extractor::str.

1371 {
1372  std::string ret_str = "nullptr";
1373  if(tensor != nullptr)
1374  {
1375  std::stringstream str;
1376  str << "ITensor->info(): " << tensor->info();
1377  ret_str = str.str();
1378  }
1379  return ret_str;
1380 }
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ to_string() [27/91]

std::string arm_compute::to_string ( ITensor tensor)
inline

Formatted output of the ITensorInfo type obtained from the ITensor* type.

Parameters
[in]tensorType to output.
Returns
Formatted string.

Definition at line 1388 of file TypePrinter.h.

References to_string().

1389 {
1390  return to_string(static_cast<const ITensor *>(tensor));
1391 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ to_string() [28/91]

std::string arm_compute::to_string ( ITensor tensor)
inline

Formatted output of the ITensorInfo type obtained from the ITensor& type.

Parameters
[in]tensorType to output.
Returns
Formatted string.

Definition at line 1399 of file TypePrinter.h.

References ITensor::info(), caffe_mnist_image_extractor::str, and to_string().

1400 {
1401  std::stringstream str;
1402  str << "ITensor.info(): " << tensor.info();
1403  return str.str();
1404 }
CLTensor * tensor
Pointer to the auxiliary tensor.

◆ to_string() [29/91]

std::string arm_compute::to_string ( const Dimensions< T > &  dimensions)
inline

Formatted output of the Dimensions type.

Parameters
[in]dimensionsType to output.
Returns
Formatted string.

Definition at line 1444 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1445 {
1446  std::stringstream str;
1447  str << dimensions;
1448  return str.str();
1449 }

◆ to_string() [30/91]

std::string arm_compute::to_string ( const Strides stride)
inline

Formatted output of the Strides type.

Parameters
[in]strideType to output.
Returns
Formatted string.

Definition at line 1457 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1458 {
1459  std::stringstream str;
1460  str << stride;
1461  return str.str();
1462 }

◆ to_string() [31/91]

std::string arm_compute::to_string ( const TensorShape shape)
inline

Formatted output of the TensorShape type.

Parameters
[in]shapeType to output.
Returns
Formatted string.

Definition at line 1470 of file TypePrinter.h.

References arm_compute::test::validation::shape, and caffe_mnist_image_extractor::str.

1471 {
1472  std::stringstream str;
1473  str << shape;
1474  return str.str();
1475 }

◆ to_string() [32/91]

std::string arm_compute::to_string ( const Coordinates coord)
inline

Formatted output of the Coordinates type.

Parameters
[in]coordType to output.
Returns
Formatted string.

Definition at line 1483 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1484 {
1485  std::stringstream str;
1486  str << coord;
1487  return str.str();
1488 }

◆ to_string() [33/91]

std::string arm_compute::to_string ( const WeightsInfo info)
inline

Formatted output of the WeightsInfo type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1574 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1575 {
1576  std::stringstream str;
1577  str << info;
1578  return str.str();
1579 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [34/91]

std::string arm_compute::to_string ( const GEMMReshapeInfo info)
inline

Formatted output of the GEMMReshapeInfo type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1587 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1588 {
1589  std::stringstream str;
1590  str << info;
1591  return str.str();
1592 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [35/91]

std::string arm_compute::to_string ( const GEMMInfo info)
inline

Formatted output of the GEMMInfo type.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 1600 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

1601 {
1602  std::stringstream str;
1603  str << info;
1604  return str.str();
1605 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [36/91]

std::string arm_compute::to_string ( const Window::Dimension dim)
inline

Formatted output of the Window::Dimension type.

Parameters
[in]dimType to output.
Returns
Formatted string.

Definition at line 1613 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1614 {
1615  std::stringstream str;
1616  str << dim;
1617  return str.str();
1618 }

◆ to_string() [37/91]

std::string arm_compute::to_string ( const Window win)
inline

Formatted output of the Window& type.

Parameters
[in]winType to output.
Returns
Formatted string.

Definition at line 1625 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1626 {
1627  std::stringstream str;
1628  str << win;
1629  return str.str();
1630 }

◆ to_string() [38/91]

std::string arm_compute::to_string ( Window win)
inline

Formatted output of the Window* type.

Parameters
[in]winType to output.
Returns
Formatted string.

Definition at line 1638 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1639 {
1640  std::string ret_str = "nullptr";
1641  if(win != nullptr)
1642  {
1643  std::stringstream str;
1644  str << *win;
1645  ret_str = str.str();
1646  }
1647  return ret_str;
1648 }

◆ to_string() [39/91]

std::string arm_compute::to_string ( const PaddingMode mode)
inline

Formatted output of the PaddingMode type.

Parameters
[in]modeType to output.
Returns
Formatted string.

Definition at line 1698 of file TypePrinter.h.

References clang_tidy_rules::mode, and caffe_mnist_image_extractor::str.

1699 {
1700  std::stringstream str;
1701  str << mode;
1702  return str.str();
1703 }

◆ to_string() [40/91]

std::string arm_compute::to_string ( const PadStrideInfo pad_stride_info)
inline

Formatted output of the PadStrideInfo type.

Parameters
[in]pad_stride_infoType to output.
Returns
Formatted string.

Definition at line 1728 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1729 {
1730  std::stringstream str;
1731  str << pad_stride_info;
1732  return str.str();
1733 }

◆ to_string() [41/91]

std::string arm_compute::to_string ( const BorderMode mode)
inline

Formatted output of the BorderMode type.

Parameters
[in]modeType to output.
Returns
Formatted string.

Definition at line 1741 of file TypePrinter.h.

References clang_tidy_rules::mode, and caffe_mnist_image_extractor::str.

1742 {
1743  std::stringstream str;
1744  str << mode;
1745  return str.str();
1746 }

◆ to_string() [42/91]

std::string arm_compute::to_string ( const BorderSize border)
inline

Formatted output of the BorderSize type.

Parameters
[in]borderType to output.
Returns
Formatted string.

Definition at line 1754 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1755 {
1756  std::stringstream str;
1757  str << border;
1758  return str.str();
1759 }

◆ to_string() [43/91]

std::string arm_compute::to_string ( const PaddingList padding)
inline

Formatted output of the PaddingList type.

Parameters
[in]paddingType to output.
Returns
Formatted string.

Definition at line 1767 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1768 {
1769  std::stringstream str;
1770  str << padding;
1771  return str.str();
1772 }

◆ to_string() [44/91]

std::string arm_compute::to_string ( const Multiples multiples)
inline

Formatted output of the Multiples type.

Parameters
[in]multiplesType to output.
Returns
Formatted string.

Definition at line 1780 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1781 {
1782  std::stringstream str;
1783  str << multiples;
1784  return str.str();
1785 }

◆ to_string() [45/91]

std::string arm_compute::to_string ( const InterpolationPolicy policy)
inline

Formatted output of the InterpolationPolicy type.

Parameters
[in]policyType to output.
Returns
Formatted string.

Definition at line 1793 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1794 {
1795  std::stringstream str;
1796  str << policy;
1797  return str.str();
1798 }

◆ to_string() [46/91]

std::string arm_compute::to_string ( const SamplingPolicy policy)
inline

Formatted output of the SamplingPolicy type.

Parameters
[in]policyType to output.
Returns
Formatted string.

Definition at line 1806 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1807 {
1808  std::stringstream str;
1809  str << policy;
1810  return str.str();
1811 }

◆ to_string() [47/91]

std::string arm_compute::to_string ( const ConvertPolicy policy)
inline

Definition at line 1837 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1838 {
1839  std::stringstream str;
1840  str << policy;
1841  return str.str();
1842 }

◆ to_string() [48/91]

std::string arm_compute::to_string ( const ArithmeticOperation op)
inline

Formatted output of the Arithmetic Operation.

Parameters
[in]opType to output.
Returns
Formatted string.

Definition at line 1889 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1890 {
1891  std::stringstream str;
1892  str << op;
1893  return str.str();
1894 }

◆ to_string() [49/91]

std::string arm_compute::to_string ( const ReductionOperation op)
inline

Formatted output of the Reduction Operations.

Parameters
[in]opType to output.
Returns
Formatted string.

Definition at line 1944 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

1945 {
1946  std::stringstream str;
1947  str << op;
1948  return str.str();
1949 }

◆ to_string() [50/91]

std::string arm_compute::to_string ( const ComparisonOperation op)
inline

Formatted output of the Comparison Operations.

Parameters
[in]opType to output.
Returns
Formatted string.

Definition at line 2035 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2036 {
2037  std::stringstream str;
2038  str << op;
2039  return str.str();
2040 }

◆ to_string() [51/91]

std::string arm_compute::to_string ( const ElementWiseUnary op)
inline

Formatted output of the Elementwise unary Operations.

Parameters
[in]opType to output.
Returns
Formatted string.

Definition at line 2048 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2049 {
2050  std::stringstream str;
2051  str << op;
2052  return str.str();
2053 }

◆ to_string() [52/91]

std::string arm_compute::to_string ( const NormType type)
inline

Formatted output of the Norm Type.

Parameters
[in]typeType to output.
Returns
Formatted string.

Definition at line 2061 of file TypePrinter.h.

References caffe_mnist_image_extractor::str, and type.

2062 {
2063  std::stringstream str;
2064  str << type;
2065  return str.str();
2066 }
decltype(strategy::transforms) typedef type

◆ to_string() [53/91]

std::string arm_compute::to_string ( const PoolingType type)
inline

Formatted output of the Pooling Type.

Parameters
[in]typeType to output.
Returns
Formatted string.

Definition at line 2074 of file TypePrinter.h.

References caffe_mnist_image_extractor::str, and type.

2075 {
2076  std::stringstream str;
2077  str << type;
2078  return str.str();
2079 }
decltype(strategy::transforms) typedef type

◆ to_string() [54/91]

std::string arm_compute::to_string ( const PoolingLayerInfo info)
inline

Formatted output of the Pooling Layer Info.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 2087 of file TypePrinter.h.

References PoolingLayerInfo::data_layout, Size2D::height, PoolingLayerInfo::is_global_pooling, PoolingLayerInfo::pad_stride_info, PoolingLayerInfo::pool_size, PoolingLayerInfo::pool_type, caffe_mnist_image_extractor::str, and Size2D::width.

2088 {
2089  std::stringstream str;
2090  str << "{Type=" << info.pool_type << ","
2091  << "DataLayout=" << info.data_layout << ","
2092  << "IsGlobalPooling=" << info.is_global_pooling;
2093  if(!info.is_global_pooling)
2094  {
2095  str << ","
2096  << "PoolSize=" << info.pool_size.width << "," << info.pool_size.height << ","
2097  << "PadStride=" << info.pad_stride_info;
2098  }
2099  str << "}";
2100  return str.str();
2101 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
DataLayout data_layout
Data layout to use.

◆ to_string() [55/91]

std::string arm_compute::to_string ( const Size3D type)
inline

Formatted output of the Size3D type.

Parameters
[in]typeType to output
Returns
Formatted string.

Definition at line 2123 of file TypePrinter.h.

References caffe_mnist_image_extractor::str, and type.

2124 {
2125  std::stringstream str;
2126  str << type;
2127  return str.str();
2128 }
decltype(strategy::transforms) typedef type

◆ to_string() [56/91]

std::string arm_compute::to_string ( const Padding3D padding3d)
inline

Converts a Padding3D to string.

Parameters
[in]padding3dPadding3D value to be converted
Returns
String representing the corresponding Padding3D

Definition at line 2151 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2152 {
2153  std::stringstream str;
2154  str << padding3d;
2155  return str.str();
2156 }

◆ to_string() [57/91]

std::string arm_compute::to_string ( const Pooling3dLayerInfo info)
inline

Formatted output of the Pooling 3d Layer Info.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 2212 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

2213 {
2214  std::stringstream str;
2215  str << info;
2216  return str.str();
2217 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [58/91]

std::string arm_compute::to_string ( const PriorBoxLayerInfo info)
inline

Formatted output of the PriorBoxLayerInfo.

Parameters
[in]infoType to output.
Returns
Formatted string.

Definition at line 2225 of file TypePrinter.h.

References PriorBoxLayerInfo::clip(), PriorBoxLayerInfo::flip(), PriorBoxLayerInfo::img_size(), PriorBoxLayerInfo::max_sizes(), PriorBoxLayerInfo::min_sizes(), PriorBoxLayerInfo::offset(), PriorBoxLayerInfo::steps(), caffe_mnist_image_extractor::str, PriorBoxLayerInfo::variances(), Coordinates2D::x, and Coordinates2D::y.

2226 {
2227  std::stringstream str;
2228  str << "{";
2229  str << "Clip:" << info.clip()
2230  << "Flip:" << info.flip()
2231  << "StepX:" << info.steps()[0]
2232  << "StepY:" << info.steps()[1]
2233  << "MinSizes:" << info.min_sizes().size()
2234  << "MaxSizes:" << info.max_sizes().size()
2235  << "ImgSizeX:" << info.img_size().x
2236  << "ImgSizeY:" << info.img_size().y
2237  << "Offset:" << info.offset()
2238  << "Variances:" << info.variances().size();
2239  str << "}";
2240  return str.str();
2241 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [59/91]

std::string arm_compute::to_string ( const Size2D type)
inline

Formatted output of the Size2D type.

Parameters
[in]typeType to output
Returns
Formatted string.

Definition at line 2263 of file TypePrinter.h.

References caffe_mnist_image_extractor::str, and type.

2264 {
2265  std::stringstream str;
2266  str << type;
2267  return str.str();
2268 }
decltype(strategy::transforms) typedef type

◆ to_string() [60/91]

std::string arm_compute::to_string ( const ConvolutionMethod conv_method)
inline

Formatted output of the ConvolutionMethod type.

Parameters
[in]conv_methodType to output
Returns
Formatted string.

Definition at line 2309 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2310 {
2311  std::stringstream str;
2312  str << conv_method;
2313  return str.str();
2314 }

◆ to_string() [61/91]

std::string arm_compute::to_string ( const GPUTarget gpu_target)
inline

Formatted output of the GPUTarget type.

Parameters
[in]gpu_targetType to output
Returns
Formatted string.

Definition at line 2424 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2425 {
2426  std::stringstream str;
2427  str << gpu_target;
2428  return str.str();
2429 }

◆ to_string() [62/91]

std::string arm_compute::to_string ( const DetectionOutputLayerCodeType detection_code)
inline

Formatted output of the DetectionOutputLayerCodeType type.

Parameters
[in]detection_codeType to output
Returns
Formatted string.

Definition at line 2485 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2486 {
2487  std::stringstream str;
2488  str << detection_code;
2489  return str.str();
2490 }

◆ to_string() [63/91]

std::string arm_compute::to_string ( const DetectionOutputLayerInfo detection_info)
inline

Formatted output of the DetectionOutputLayerInfo type.

Parameters
[in]detection_infoType to output
Returns
Formatted string.

Definition at line 2523 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2524 {
2525  std::stringstream str;
2526  str << detection_info;
2527  return str.str();
2528 }

◆ to_string() [64/91]

std::string arm_compute::to_string ( const DetectionPostProcessLayerInfo detection_info)
inline

Formatted output of the DetectionPostProcessLayerInfo type.

Parameters
[in]detection_infoType to output
Returns
Formatted string.

Definition at line 2560 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2561 {
2562  std::stringstream str;
2563  str << detection_info;
2564  return str.str();
2565 }

◆ to_string() [65/91]

std::string arm_compute::to_string ( const DetectionWindow detection_window)
inline

Formatted output of the DetectionWindow type.

Parameters
[in]detection_windowType to output
Returns
Formatted string.

Definition at line 2573 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2574 {
2575  std::stringstream str;
2576  str << detection_window;
2577  return str.str();
2578 }

◆ to_string() [66/91]

std::string arm_compute::to_string ( const WinogradInfo type)
inline

Definition at line 2614 of file TypePrinter.h.

References caffe_mnist_image_extractor::str, and type.

2615 {
2616  std::stringstream str;
2617  str << type;
2618  return str.str();
2619 }
decltype(strategy::transforms) typedef type

◆ to_string() [67/91]

std::string arm_compute::to_string ( const CLTunerMode  val)
inline

Convert a CLTunerMode value to a string.

Parameters
valCLTunerMode value to be converted
Returns
String representing the corresponding CLTunerMode.

Definition at line 2627 of file TypePrinter.h.

References ARM_COMPUTE_ERROR, EXHAUSTIVE, NORMAL, and RAPID.

2628 {
2629  switch(val)
2630  {
2631  case CLTunerMode::EXHAUSTIVE:
2632  {
2633  return std::string("Exhaustive");
2634  }
2635  case CLTunerMode::NORMAL:
2636  {
2637  return std::string("Normal");
2638  }
2639  case CLTunerMode::RAPID:
2640  {
2641  return std::string("Rapid");
2642  }
2643  default:
2644  {
2645  ARM_COMPUTE_ERROR("Invalid tuner mode.");
2646  return std::string("UNDEFINED");
2647  }
2648  }
2649 }
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Definition: Error.h:352

◆ to_string() [68/91]

std::string arm_compute::to_string ( CLGEMMKernelType  val)
inline

Converts a CLGEMMKernelType to string.

Parameters
[in]valCLGEMMKernelType value to be converted
Returns
String representing the corresponding CLGEMMKernelType

Definition at line 2656 of file TypePrinter.h.

References NATIVE, RESHAPED, and RESHAPED_ONLY_RHS.

2657 {
2658  switch(val)
2659  {
2660  case CLGEMMKernelType::NATIVE:
2661  {
2662  return "Native";
2663  }
2664  case CLGEMMKernelType::RESHAPED_ONLY_RHS:
2665  {
2666  return "Reshaped_Only_RHS";
2667  }
2668  case CLGEMMKernelType::RESHAPED:
2669  {
2670  return "Reshaped";
2671  }
2672  default:
2673  {
2674  return "Unknown";
2675  }
2676  }
2677 }

◆ to_string() [69/91]

std::string arm_compute::to_string ( const ConvolutionInfo info)
inline

Converts a ConvolutionInfo to string.

Parameters
[in]infoConvolutionInfo value to be converted
Returns
String representing the corresponding ConvolutionInfo

Definition at line 2714 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

2715 {
2716  std::stringstream str;
2717  str << info;
2718  return str.str();
2719 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [70/91]

std::string arm_compute::to_string ( const FullyConnectedLayerInfo info)
inline

Converts a FullyConnectedLayerInfo to string.

Parameters
[in]infoFullyConnectedLayerInfo value to be converted
Returns
String representing the corresponding FullyConnectedLayerInfo

Definition at line 2746 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

2747 {
2748  std::stringstream str;
2749  str << info;
2750  return str.str();
2751 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [71/91]

std::string arm_compute::to_string ( const GEMMLowpOutputStageType gemm_type)
inline

Converts a GEMMLowpOutputStageType to string.

Parameters
[in]gemm_typeGEMMLowpOutputStageType value to be converted
Returns
String representing the corresponding GEMMLowpOutputStageType

Definition at line 2788 of file TypePrinter.h.

References arm_compute::mlgo::parser::gemm_type(), and caffe_mnist_image_extractor::str.

2789 {
2790  std::stringstream str;
2791  str << gemm_type;
2792  return str.str();
2793 }
GEMMType gemm_type(TokenStream &in, bool &valid)
Definition: MLGOParser.cpp:567

◆ to_string() [72/91]

std::string arm_compute::to_string ( const GEMMLowpOutputStageInfo gemm_info)
inline

Converts a GEMMLowpOutputStageInfo to string.

Parameters
[in]gemm_infoGEMMLowpOutputStageInfo value to be converted
Returns
String representing the corresponding GEMMLowpOutputStageInfo

Definition at line 2824 of file TypePrinter.h.

References arm_compute::test::validation::gemm_info, and caffe_mnist_image_extractor::str.

2825 {
2826  std::stringstream str;
2827  str << gemm_info;
2828  return str.str();
2829 }

◆ to_string() [73/91]

std::string arm_compute::to_string ( const Conv2dInfo conv_info)
inline

Converts a Conv2dInfo to string.

Parameters
[in]conv_infoConv2dInfo value to be converted
Returns
String representing the corresponding Conv2dInfo

Definition at line 2855 of file TypePrinter.h.

References arm_compute::test::validation::conv_info, and caffe_mnist_image_extractor::str.

2856 {
2857  std::stringstream str;
2858  str << conv_info;
2859  return str.str();
2860 }

◆ to_string() [74/91]

std::string arm_compute::to_string ( const PixelValue pixel_value)
inline

Converts a PixelValue to string.

Parameters
[in]pixel_valuePixelValue value to be converted
Returns
String representing the corresponding PixelValue

Definition at line 2881 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2882 {
2883  std::stringstream str;
2884  str << pixel_value;
2885  return str.str();
2886 }

◆ to_string() [75/91]

std::string arm_compute::to_string ( const ScaleKernelInfo scale_info)
inline

Converts a ScaleKernelInfo to string.

Parameters
[in]scale_infoScaleKernelInfo value to be converted
Returns
String representing the corresponding ScaleKernelInfo

Definition at line 2913 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2914 {
2915  std::stringstream str;
2916  str << scale_info;
2917  return str.str();
2918 }

◆ to_string() [76/91]

std::string arm_compute::to_string ( const FFTDirection fft_dir)
inline

Converts a FFT1DInfo to string.

Parameters
[in]fft_dirFFT1DInfo value to be converted
Returns
String representing the corresponding FFT1DInfo

Definition at line 2949 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2950 {
2951  std::stringstream str;
2952  str << "{" << fft_dir << "}";
2953  return str.str();
2954 }

◆ to_string() [77/91]

std::string arm_compute::to_string ( const FFT1DInfo fft1d_info)
inline

Converts a FFT1DInfo to string.

Parameters
[in]fft1d_infoFFT1DInfo value to be converted
Returns
String representing the corresponding FFT1DInfo

Definition at line 2976 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

2977 {
2978  std::stringstream str;
2979  str << fft1d_info;
2980  return str.str();
2981 }

◆ to_string() [78/91]

std::string arm_compute::to_string ( const FFT2DInfo fft2d_info)
inline

Converts a FFT2DInfo to string.

Parameters
[in]fft2d_infoFFT2DInfo value to be converted
Returns
String representing the corresponding FFT2DInfo

Definition at line 3004 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3005 {
3006  std::stringstream str;
3007  str << fft2d_info;
3008  return str.str();
3009 }

◆ to_string() [79/91]

std::string arm_compute::to_string ( const Coordinates2D coord_2d)
inline

Converts a Coordinates2D to string.

Parameters
[in]coord_2dCoordinates2D value to be converted
Returns
String representing the corresponding Coordinates2D

Definition at line 3031 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3032 {
3033  std::stringstream str;
3034  str << coord_2d;
3035  return str.str();
3036 }

◆ to_string() [80/91]

std::string arm_compute::to_string ( const FuseBatchNormalizationType fuse_type)
inline

Converts a FuseBatchNormalizationType to string.

Parameters
[in]fuse_typeFuseBatchNormalizationType value to be converted
Returns
String representing the corresponding FuseBatchNormalizationType

Definition at line 3067 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3068 {
3069  std::stringstream str;
3070  str << fuse_type;
3071  return str.str();
3072 }

◆ to_string() [81/91]

std::string arm_compute::to_string ( const SoftmaxKernelInfo info)
inline

Converts a SoftmaxKernelInfo to string.

Parameters
[in]infoSoftmaxKernelInfo value to be converted
Returns
String representing the corresponding SoftmaxKernelInfo

Definition at line 3096 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

3097 {
3098  std::stringstream str;
3099  str << info;
3100  return str.str();
3101 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [82/91]

std::string arm_compute::to_string ( const LSTMParams< T > &  lstm_params)

Converts a LSTMParams to string.

Parameters
[in]lstm_paramsLSTMParams<T> value to be converted
Returns
String representing the corresponding LSTMParams

Definition at line 3146 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3147 {
3148  std::stringstream str;
3149  str << lstm_params;
3150  return str.str();
3151 }

◆ to_string() [83/91]

std::string arm_compute::to_string ( const uint8_t  num)
inline

Converts a LSTMParams to string.

Parameters
[in]numuint8_t value to be converted
Returns
String representing the corresponding uint8_t

Definition at line 3159 of file TypePrinter.h.

References to_string().

3160 {
3161  // Explicity cast the uint8_t to signed integer and call the corresponding overloaded to_string() function.
3162  return ::std::to_string(static_cast<int>(num));
3163 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ to_string() [84/91]

std::string arm_compute::to_string ( const NMSType  nms_type)
inline

Converts a NMSType to string.

Parameters
[in]nms_typeNMSType value to be converted
Returns
String representing the corresponding NMSType

Definition at line 3198 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3199 {
3200  std::stringstream str;
3201  str << nms_type;
3202  return str.str();
3203 }

◆ to_string() [85/91]

std::string arm_compute::to_string ( const BoxNMSLimitInfo info)
inline

Converts a BoxNMSLimitInfo to string.

Parameters
[in]infoBoxNMSLimitInfo value to be converted
Returns
String representing the corresponding BoxNMSLimitInfo

Definition at line 3232 of file TypePrinter.h.

References arm_compute::test::validation::info, and caffe_mnist_image_extractor::str.

3233 {
3234  std::stringstream str;
3235  str << info;
3236  return str.str();
3237 }
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)

◆ to_string() [86/91]

std::string arm_compute::to_string ( const DimensionRoundingType rounding_type)
inline

Converts a DimensionRoundingType to string.

Parameters
[in]rounding_typeDimensionRoundingType value to be converted
Returns
String representing the corresponding DimensionRoundingType

Definition at line 3245 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3246 {
3247  std::stringstream str;
3248  str << rounding_type;
3249  return str.str();
3250 }

◆ to_string() [87/91]

std::string arm_compute::to_string ( const Conv3dInfo conv3d_info)
inline

Formatted output of the Conv3dInfo type.

Parameters
[in]conv3d_infoType to output.
Returns
Formatted string.

Definition at line 3282 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3283 {
3284  std::stringstream str;
3285  str << conv3d_info;
3286  return str.str();
3287 }

◆ to_string() [88/91]

std::string arm_compute::to_string ( const WeightFormat  wf)
inline

Formatted output of the arm_compute::WeightFormat type.

Parameters
[in]wfarm_compute::WeightFormat Type to output.
Returns
Formatted string.

Definition at line 3295 of file TypePrinter.h.

References __CASE_WEIGHT_FORMAT, ANY, OHWI, OHWIo128, OHWIo16, OHWIo16i2, OHWIo16i2_bf16, OHWIo16i4, OHWIo16i4_bf16, OHWIo16i8, OHWIo2, OHWIo2i8, OHWIo32, OHWIo32i2, OHWIo32i2_bf16, OHWIo32i4, OHWIo32i4_bf16, OHWIo32i8, OHWIo4, OHWIo4i2, OHWIo4i2_bf16, OHWIo4i4, OHWIo4i4_bf16, OHWIo4i8, OHWIo64, OHWIo64i2, OHWIo64i2_bf16, OHWIo64i4, OHWIo64i4_bf16, OHWIo64i8, OHWIo8, OHWIo8i2, OHWIo8i2_bf16, OHWIo8i4, OHWIo8i4_bf16, OHWIo8i8, and UNSPECIFIED.

3296 {
3297 #define __CASE_WEIGHT_FORMAT(wf) \
3298 case WeightFormat::wf: \
3299  return #wf;
3300  switch(wf)
3301  {
3302  __CASE_WEIGHT_FORMAT(UNSPECIFIED)
3304  __CASE_WEIGHT_FORMAT(OHWI)
3305  __CASE_WEIGHT_FORMAT(OHWIo2)
3306  __CASE_WEIGHT_FORMAT(OHWIo4)
3307  __CASE_WEIGHT_FORMAT(OHWIo8)
3308  __CASE_WEIGHT_FORMAT(OHWIo16)
3309  __CASE_WEIGHT_FORMAT(OHWIo32)
3310  __CASE_WEIGHT_FORMAT(OHWIo64)
3311  __CASE_WEIGHT_FORMAT(OHWIo128)
3312  __CASE_WEIGHT_FORMAT(OHWIo4i2)
3313  __CASE_WEIGHT_FORMAT(OHWIo4i2_bf16)
3314  __CASE_WEIGHT_FORMAT(OHWIo8i2)
3315  __CASE_WEIGHT_FORMAT(OHWIo8i2_bf16)
3316  __CASE_WEIGHT_FORMAT(OHWIo16i2)
3317  __CASE_WEIGHT_FORMAT(OHWIo16i2_bf16)
3318  __CASE_WEIGHT_FORMAT(OHWIo32i2)
3319  __CASE_WEIGHT_FORMAT(OHWIo32i2_bf16)
3320  __CASE_WEIGHT_FORMAT(OHWIo64i2)
3321  __CASE_WEIGHT_FORMAT(OHWIo64i2_bf16)
3322  __CASE_WEIGHT_FORMAT(OHWIo4i4)
3323  __CASE_WEIGHT_FORMAT(OHWIo4i4_bf16)
3324  __CASE_WEIGHT_FORMAT(OHWIo8i4)
3325  __CASE_WEIGHT_FORMAT(OHWIo8i4_bf16)
3326  __CASE_WEIGHT_FORMAT(OHWIo16i4)
3327  __CASE_WEIGHT_FORMAT(OHWIo16i4_bf16)
3328  __CASE_WEIGHT_FORMAT(OHWIo32i4)
3329  __CASE_WEIGHT_FORMAT(OHWIo32i4_bf16)
3330  __CASE_WEIGHT_FORMAT(OHWIo64i4)
3331  __CASE_WEIGHT_FORMAT(OHWIo64i4_bf16)
3332  __CASE_WEIGHT_FORMAT(OHWIo2i8)
3333  __CASE_WEIGHT_FORMAT(OHWIo4i8)
3334  __CASE_WEIGHT_FORMAT(OHWIo8i8)
3335  __CASE_WEIGHT_FORMAT(OHWIo16i8)
3336  __CASE_WEIGHT_FORMAT(OHWIo32i8)
3337  __CASE_WEIGHT_FORMAT(OHWIo64i8)
3338  default:
3339  return "invalid value";
3340  }
3341 #undef __CASE_WEIGHT_FORMAT
3342 }
#define __CASE_WEIGHT_FORMAT(wf)

◆ to_string() [89/91]

std::string arm_compute::to_string ( const std::tuple< TensorShape, TensorShape, arm_compute::WeightFormat values)
inline

Formatted output of the std::tuple<TensorShape, TensorShape, arm_compute::WeightFormat> tuple.

Parameters
[in]valuestuple of input and output tensor shapes and WeightFormat used.
Returns
Formatted string.

Definition at line 3363 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3364 {
3365  std::stringstream str;
3366  str << "[Input shape = " << std::get<0>(values);
3367  str << ", ";
3368  str << "Expected output shape = " << std::get<1>(values);
3369 
3370  str << ", ";
3371  str << "WeightFormat = " << std::get<2>(values) << "]";
3372  return str.str();
3373 }

◆ to_string() [90/91]

std::string arm_compute::to_string ( const Padding2D padding2d)
inline

Converts a Padding2D to string.

Parameters
[in]padding2dPadding2D value to be converted
Returns
String representing the corresponding Padding2D

Definition at line 3395 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

3396 {
3397  std::stringstream str;
3398  str << padding2d;
3399  return str.str();
3400 }

◆ to_string() [91/91]

std::string arm_compute::to_string ( const experimental::dynamic_fusion::Conv2dAttributes conv2d_attr)
inline

Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type.

Parameters
[in]conv2d_attrarm_compute::experimental::dynamic_fusion::Conv2dAttributes type to output.
Returns
Formatted string.

Definition at line 3425 of file TypePrinter.h.

References caffe_mnist_image_extractor::str.

Referenced by to_string().

3426 {
3427  std::stringstream str;
3428  str << conv2d_attr;
3429  return str.str();
3430 }

◆ to_string_if_not_null()

std::string arm_compute::to_string_if_not_null ( T *  arg)

Formatted output if arg is not null.

Parameters
[in]argObject to print
Returns
String representing arg.

Definition at line 61 of file TypePrinter.h.

References to_string().

62 {
63  if(arg == nullptr)
64  {
65  return "nullptr";
66  }
67  else
68  {
69  return to_string(*arg);
70  }
71 }
std::string to_string(const experimental::dynamic_fusion::Conv2dAttributes &conv2d_attr)
Formatted output of the arm_compute::experimental::dynamic_fusion::Conv2dAttributes type...
Definition: TypePrinter.h:3425

◆ tuner_mode_from_name()

CLTunerMode arm_compute::tuner_mode_from_name ( const std::string &  name)
inline

Converts a string to a strong types enumeration CLTunerMode.

Parameters
[in]nameString to convert
Returns
Converted CLTunerMode enumeration

Definition at line 57 of file CLTunerTypes.h.

References EXHAUSTIVE, NORMAL, RAPID, and arm_compute::utility::tolower().

Referenced by operator>>().

58 {
59  static const std::map<std::string, CLTunerMode> tuner_modes =
60  {
61  { "exhaustive", CLTunerMode::EXHAUSTIVE },
62  { "normal", CLTunerMode::NORMAL },
63  { "rapid", CLTunerMode::RAPID },
64  };
65 
66 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
67  try
68  {
69 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
70  return tuner_modes.at(arm_compute::utility::tolower(name));
71 
72 #ifndef ARM_COMPUTE_EXCEPTIONS_DISABLED
73  }
74  catch(const std::out_of_range &)
75  {
76  throw std::invalid_argument(name);
77  }
78 #endif /* ARM_COMPUTE_EXCEPTIONS_DISABLED */
79 }
std::string tolower(std::string string)
Convert string to lower case.
Definition: Utility.h:205
const char * name

◆ update_window_and_padding()

bool arm_compute::update_window_and_padding ( Window win,
Ts &&...  patterns 
)

Update window and padding size for each of the access patterns.

First the window size is reduced based on all access patterns that are not allowed to modify the padding of the underlying tensor. Then the padding of the remaining tensors is increased to match the window.

Parameters
[in]winWindow that is used by the kernel.
[in]patternsAccess patterns used to calculate the final window and padding.
Returns
True if the window has been changed. Changes to the padding do not influence the returned value.

Definition at line 46 of file WindowHelpers.h.

References arm_compute::utility::for_each(), IAccessWindow::update_padding_if_needed(), IAccessWindow::update_window_if_needed(), and arm_compute::test::validation::w.

Referenced by ICLSimpleKernel::configure(), NEBitwiseNotKernel::configure(), NEBitwiseOrKernel::configure(), NEBitwiseXorKernel::configure(), and NEBitwiseAndKernel::configure().

47 {
48  bool window_changed = false;
49 
50  utility::for_each([&](const IAccessWindow & w)
51  {
52  window_changed |= w.update_window_if_needed(win);
53  },
54  patterns...);
55 
56  utility::for_each([&](IAccessWindow & w)
57  {
58  w.update_padding_if_needed(win);
59  },
60  patterns...);
61 
62  return window_changed;
63 }
SimpleTensor< float > w
Definition: DFT.cpp:156
void for_each(F &&)
Base case of for_each.
Definition: Utility.h:110

◆ upper_string()

std::string upper_string ( const std::string &  val)

◆ validate()

Status arm_compute::validate ( const ITensorInfo scores_in,
const ITensorInfo boxes_in,
const ITensorInfo batch_splits_in,
const ITensorInfo scores_out,
const ITensorInfo boxes_out,
const ITensorInfo classes,
const ITensorInfo batch_splits_out,
const ITensorInfo keeps,
const ITensorInfo keeps_size,
const BoxNMSLimitInfo  info 
)

Definition at line 214 of file CPPBoxWithNonMaximaSuppressionLimit.cpp.

References ARM_COMPUTE_RETURN_ERROR_ON, ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES, ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO, ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR, ARM_COMPUTE_UNUSED, ITensorInfo::data_type(), F16, F32, UniformQuantizationInfo::offset, QASYMM16, QASYMM8, QASYMM8_SIGNED, ITensorInfo::quantization_info(), UniformQuantizationInfo::scale, and QuantizationInfo::uniform().

Referenced by VerifyAccessor< D >::access_tensor(), NEQLSTMLayerNormalizationKernel::configure(), and arm_compute::utils::run_example().

216 {
217  ARM_COMPUTE_UNUSED(batch_splits_in, batch_splits_out, keeps, keeps_size, info);
218  ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(scores_in, boxes_in, scores_out, boxes_out, classes);
219  ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(scores_in, 1, DataType::QASYMM8, DataType::QASYMM8_SIGNED, DataType::F16, DataType::F32);
220 
221  const bool is_qasymm8 = scores_in->data_type() == DataType::QASYMM8 || scores_in->data_type() == DataType::QASYMM8_SIGNED;
222  if(is_qasymm8)
223  {
224  ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(boxes_in, 1, DataType::QASYMM16);
227  const UniformQuantizationInfo boxes_qinfo = boxes_in->quantization_info().uniform();
228  ARM_COMPUTE_RETURN_ERROR_ON(boxes_qinfo.scale != 0.125f);
229  ARM_COMPUTE_RETURN_ERROR_ON(boxes_qinfo.offset != 0);
230  }
231 
232  return Status{};
233 }
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_QUANTIZATION_INFO(...)
Definition: Validate.h:606
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Definition: Error.h:296
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
Definition: Validate.h:159
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Definition: Error.h:152
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
Definition: Validate.h:541
#define ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(t, c,...)
Definition: Validate.h:788

◆ vdequantize() [1/9]

float32x4x4_t arm_compute::vdequantize ( const int16x8x2_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Dequantize a neon vector holding 16 16-bit quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]qiQuantization information to be used in the computation.
Returns
Dequantized values in a neon vector

Definition at line 181 of file NESymm.h.

References UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

182 {
183  const float scale = qi.scale;
184  const float32x4_t vscale = vdupq_n_f32(scale);
185  const float32x4x4_t vdequantized_input =
186  {
187  {
188  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(qv.val[0]))), vscale),
189  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(qv.val[0]))), vscale),
190  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(qv.val[1]))), vscale),
191  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(qv.val[1]))), vscale),
192  }
193  };
194  return vdequantized_input;
195 }

◆ vdequantize() [2/9]

float32x4x2_t arm_compute::vdequantize ( const uint8x8_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Dequantize a neon vector holding 8 quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]qiQuantization information to be used in the computation.
Returns
Dequantized values in a neon vector

Definition at line 415 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

Referenced by arm_compute::cpu::elementwise_comp_quantized_signed(), arm_compute::cpu::elementwise_op_quantized(), arm_compute::cpu::elementwise_op_quantized_signed(), arm_compute::cpu::neon_qasymm8_activation(), arm_compute::cpu::neon_qasymm8_signed_activation(), CpuConcatenateHeightKernel::run_op(), and CpuConcatenateWidthKernel::run_op().

416 {
417  const float scale = qi.scale;
418  const int offset = qi.offset;
419  const int32x4_t voffset = vdupq_n_s32(offset);
420  const float32x4_t vscale = vdupq_n_f32(scale);
421  const float32x4x2_t vdequantized_input =
422  {
423  {
424  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(vmovl_u8(qv)))), voffset)), vscale),
425  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(vmovl_u8(qv)))), voffset)), vscale),
426  }
427  };
428  return vdequantized_input;
429 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [3/9]

float32x4x2_t arm_compute::vdequantize ( const int8x8_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Dequantize a neon vector holding 8 singed quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]qiQuantization information to be used in the computation.
Returns
Dequantized values in a neon vector

Definition at line 438 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

439 {
440  const float scale = qi.scale;
441  const int offset = qi.offset;
442  const int32x4_t voffset = vdupq_n_s32(offset);
443  const float32x4_t vscale = vdupq_n_f32(scale);
444  const float32x4x2_t vdequantized_input =
445  {
446  {
447  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(qv))), voffset)), vscale),
448  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(qv))), voffset)), vscale),
449  }
450  };
451  return vdequantized_input;
452 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [4/9]

float32x4x4_t arm_compute::vdequantize ( const uint8x16_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Dequantize a neon vector holding 16 quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]qiQuantization information to be used in the computation.
Returns
Dequantized values in a neon vector

Definition at line 461 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

462 {
463  const float scale = qi.scale;
464  const int offset = qi.offset;
465  const int32x4_t voffset = vdupq_n_s32(offset);
466  const float32x4_t vscale = vdupq_n_f32(scale);
467  const float32x4x4_t vdequantized_input =
468  {
469  {
470  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(vmovl_u8(vget_low_u8(qv))))), voffset)), vscale),
471  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(vmovl_u8(vget_low_u8(qv))))), voffset)), vscale),
472  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(vmovl_u8(vget_high_u8(qv))))), voffset)), vscale),
473  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(vmovl_u8(vget_high_u8(qv))))), voffset)), vscale),
474  }
475  };
476  return vdequantized_input;
477 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [5/9]

float32x4x4_t arm_compute::vdequantize ( const int8x16_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Dequantize a neon vector holding 16 signed quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]qiQuantization information to be used in the computation.
Returns
Dequantized values in a neon vector

Definition at line 486 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

487 {
488  const float scale = qi.scale;
489  const int offset = qi.offset;
490  const int32x4_t voffset = vdupq_n_s32(offset);
491  const float32x4_t vscale = vdupq_n_f32(scale);
492  const float32x4x4_t vdequantized_input =
493  {
494  {
495  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale),
496  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale),
497  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale),
498  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale),
499  }
500  };
501  return vdequantized_input;
502 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [6/9]

float32x4x4_t arm_compute::vdequantize ( const uint8x16_t &  qv,
float  scale,
int32_t  offset 
)
inline

Dequantize following an asymmetric quantization scheme a neon vector holding 16 quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]scaleQuantization scaling factor.
[in]offsetZero quantization offset.
Returns
Dequantized values in a neon vector

Definition at line 512 of file NEAsymm.h.

513 {
514  const int32x4_t voffset = vdupq_n_s32(offset);
515  const float32x4_t vscale = vdupq_n_f32(scale);
516  const float32x4x4_t vdequantized_input =
517  {
518  {
519  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(vmovl_u8(vget_low_u8(qv))))), voffset)), vscale),
520  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(vmovl_u8(vget_low_u8(qv))))), voffset)), vscale),
521  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(vmovl_u8(vget_high_u8(qv))))), voffset)), vscale),
522  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(vmovl_u8(vget_high_u8(qv))))), voffset)), vscale),
523  }
524  };
525  return vdequantized_input;
526 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [7/9]

float32x4x4_t arm_compute::vdequantize ( const int8x16_t &  qv,
float  scale,
int32_t  offset 
)
inline

Dequantize a vector of 16 values stored as signed asymmetric.

Parameters
[in]qvInput values to be dequantized.
[in]scaleQuantization scaling factor.
[in]offsetZero quantization offset.
Returns
Dequantized values in a neon vector

Definition at line 536 of file NEAsymm.h.

537 {
538  const int32x4_t voffset = vdupq_n_s32(offset);
539  const float32x4_t vscale = vdupq_n_f32(scale);
540  const float32x4x4_t vdequantized_input =
541  {
542  {
543  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale),
544  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_low_s8(qv)))), voffset)), vscale),
545  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale),
546  vmulq_f32(vcvtq_f32_s32(vsubq_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_high_s8(qv)))), voffset)), vscale),
547  }
548  };
549  return vdequantized_input;
550 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vdequantize() [8/9]

float32x4x4_t arm_compute::vdequantize ( const int8x16_t &  qv,
const float32x4x4_t  vscale 
)
inline

Dequantize following symmetric quantization scheme a neon vector holding 16 quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]vscaleVector containing quantization scaling factors.
Returns
Dequantized values in a neon vector

Definition at line 559 of file NEAsymm.h.

560 {
561  const float32x4x4_t vdequantized_input =
562  {
563  {
564  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_low_s8(qv))))), vscale.val[0]),
565  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_low_s8(qv))))), vscale.val[1]),
566  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_high_s8(qv))))), vscale.val[2]),
567  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_high_s8(qv))))), vscale.val[3]),
568  }
569  };
570  return vdequantized_input;
571 }

◆ vdequantize() [9/9]

float32x4x4_t arm_compute::vdequantize ( const int8x16_t &  qv,
float  scale 
)
inline

Dequantize following a symmetric quantization scheme a neon vector holding 16 quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]scaleQuantization scaling factor.
Returns
Dequantized values in a neon vector

Definition at line 580 of file NEAsymm.h.

581 {
582  const float32x4_t vscale = vdupq_n_f32(scale);
583  const float32x4x4_t vdequantized_input =
584  {
585  {
586  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_low_s8(qv))))), vscale),
587  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_low_s8(qv))))), vscale),
588  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(vmovl_s8(vget_high_s8(qv))))), vscale),
589  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(vmovl_s8(vget_high_s8(qv))))), vscale),
590  }
591  };
592  return vdequantized_input;
593 }

◆ vdequantize_int16()

float32x4x2_t arm_compute::vdequantize_int16 ( const int16x8_t &  qv,
float  scale 
)
inline

Dequantize a neon vector holding 8 16-bit quantized values.

Parameters
[in]qvInput values to be dequantized.
[in]scaleQuantization scale
Returns
Dequantized values in a neon vector

Definition at line 135 of file NESymm.h.

Referenced by arm_compute::cpu::neon_qsymm16_activation().

136 {
137  const float32x4_t vscale = vdupq_n_f32(scale);
138  const float32x4x2_t vdequantized_input =
139  {
140  {
141  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_low_s16(qv))), vscale),
142  vmulq_f32(vcvtq_f32_s32(vmovl_s16(vget_high_s16(qv))), vscale)
143  }
144  };
145  return vdequantized_input;
146 }

◆ verfq_f32()

float32x4_t arm_compute::verfq_f32 ( float32x4_t  x)

Calculate error function.

Parameters
[in]xInput vector in F32 format.
Returns
The calculated erf.

Referenced by vreduce().

◆ vexpq_f32()

float32x4_t arm_compute::vexpq_f32 ( float32x4_t  x)

Calculate exponential.

Parameters
[in]xInput vector value in F32 format.
Returns
The calculated exponent.

Referenced by arm_compute::cpu::neon_softmax_logits_1d_quantized(), and vreduce().

◆ vfloorq_f32()

float32x4_t arm_compute::vfloorq_f32 ( float32x4_t  val)

Calculate floor of a vector.

Parameters
[in]valInput vector value in F32 format.
Returns
The calculated floor vector.

Referenced by arm_compute::cpu::elementwise_arithm_op< ArithmeticOperation::DIV, typename wrapper::traits::neon_vector< int32_t, 4 > >(), and arm_compute::cpu::fp32_neon_floor().

◆ vinv_f32()

float32x2_t arm_compute::vinv_f32 ( float32x2_t  x)

Calculate reciprocal.

Parameters
[in]xInput value.
Returns
The calculated reciprocal.

◆ vinvq_f32()

float32x4_t arm_compute::vinvq_f32 ( float32x4_t  x)

Calculate reciprocal.

Parameters
[in]xInput value.
Returns
The calculated reciprocal.

◆ vinvsqrt_f32()

float32x2_t arm_compute::vinvsqrt_f32 ( float32x2_t  x)

Calculate inverse square root.

Parameters
[in]xInput value.
Returns
The calculated inverse square root.

◆ vinvsqrtq_f32()

float32x4_t arm_compute::vinvsqrtq_f32 ( float32x4_t  x)

Calculate inverse square root.

Parameters
[in]xInput value.
Returns
The calculated inverse square root.

◆ vlogq_f32()

float32x4_t arm_compute::vlogq_f32 ( float32x4_t  x)

Calculate logarithm.

Parameters
[in]xInput vector value in F32 format.
Returns
The calculated logarithm.

Referenced by vreduce().

◆ vmax2q_f32()

float32x4x2_t arm_compute::vmax2q_f32 ( float32x4x2_t  a,
float32x4x2_t  b 
)

Compute lane-by-lane maximum between elements of a float vector with 4x2 elements.

Parameters
[in]aFloat input vector
[in]bFloat input vector
Returns
The lane-by-lane maximum -> float32x4x2

◆ vmlaq_qasymm8()

qasymm8x16_t vmlaq_qasymm8 ( qasymm8x16_t  vd,
float32x4_t  vs,
float32x4_t  vo 
)
inline

Perform a multiply-accumulate on all 16 components of a QASYMM8 vector.

vd*vs + vo

Parameters
[in]vdInput vector value in QASYMM8 format
[in]vsVector multiplier in F32 format. The multiplier value must be duplicated across all four lanes.
[in]voVector addend in F32 format. The addend value must be duplicated across all four lanes.
Returns
A 16-component vector in QASYMM8 format, saturated to fit

Definition at line 26 of file NEAsymm.inl.

Referenced by arm_compute::cpu::neon_qasymm8_activation().

27 {
28  // Convert uint8 vectors to uint16 vectors
29  const uint8x8_t vd_low = vget_low_u8(vd);
30  const uint8x8_t vd_high = vget_high_u8(vd);
31  uint16x8_t vd_low_u16x8 = vmovl_u8(vd_low);
32  uint16x8_t vd_high_u16x8 = vmovl_u8(vd_high);
33  // Convert uint16 vectors to uint32 vectors
34  uint32x4_t A_u32x4 = vmovl_u16(vget_low_u16(vd_low_u16x8));
35  uint32x4_t B_u32x4 = vmovl_u16(vget_high_u16(vd_low_u16x8));
36  uint32x4_t C_u32x4 = vmovl_u16(vget_low_u16(vd_high_u16x8));
37  uint32x4_t D_u32x4 = vmovl_u16(vget_high_u16(vd_high_u16x8));
38  // Convert uint32 vectors to float32 vectors
39  float32x4_t A_f32x4 = vcvtq_f32_u32(A_u32x4);
40  float32x4_t B_f32x4 = vcvtq_f32_u32(B_u32x4);
41  float32x4_t C_f32x4 = vcvtq_f32_u32(C_u32x4);
42  float32x4_t D_f32x4 = vcvtq_f32_u32(D_u32x4);
43  // vd = vd*vs + vo
44  A_f32x4 = vmlaq_f32(vo, A_f32x4, vs);
45  B_f32x4 = vmlaq_f32(vo, B_f32x4, vs);
46  C_f32x4 = vmlaq_f32(vo, C_f32x4, vs);
47  D_f32x4 = vmlaq_f32(vo, D_f32x4, vs);
48  // Convert float32 vectors to uint32 vectors
49  A_u32x4 = vcvtq_u32_f32(A_f32x4);
50  B_u32x4 = vcvtq_u32_f32(B_f32x4);
51  C_u32x4 = vcvtq_u32_f32(C_f32x4);
52  D_u32x4 = vcvtq_u32_f32(D_f32x4);
53  // Convert uint32 vectors to uint16 vectors (with saturation)
54  vd_low_u16x8 = vcombine_u16(vqmovn_u32(A_u32x4), vqmovn_u32(B_u32x4));
55  vd_high_u16x8 = vcombine_u16(vqmovn_u32(C_u32x4), vqmovn_u32(D_u32x4));
56  // convert uint16 vectors to uint8 vectors (with saturation)
57  return vcombine_u8(vqmovn_u16(vd_low_u16x8), vqmovn_u16(vd_high_u16x8));
58 }

◆ vmlaq_qasymm8_signed()

qasymm8x16_signed_t vmlaq_qasymm8_signed ( qasymm8x16_signed_t  vd,
float32x4_t  vs,
float32x4_t  vo 
)
inline

Perform a multiply-accumulate on all 16 components of a QASYMM8_SIGNED vector.

vd*vs + vo

Parameters
[in]vdInput vector value in QASYMM8_SIGNED format
[in]vsVector multiplier in F32 format. The multiplier value must be duplicated across all four lanes.
[in]voVector addend in F32 format. The addend value must be duplicated across all four lanes.
Returns
A 16-component vector in QASYMM8_SIGNED format, saturated to fit

Definition at line 59 of file NEAsymm.inl.

Referenced by arm_compute::cpu::neon_qasymm8_signed_activation().

60 {
61  // Convert uint8 vectors to int16 vectors
62  const int8x8_t vd_low = vget_low_s8(vd);
63  const int8x8_t vd_high = vget_high_s8(vd);
64  int16x8_t vd_low_s16x8 = vmovl_s8(vd_low);
65  int16x8_t vd_high_s16x8 = vmovl_s8(vd_high);
66  // Convert int16 vectors to int32 vectors
67  int32x4_t A_s32x4 = vmovl_s16(vget_low_s16(vd_low_s16x8));
68  int32x4_t B_s32x4 = vmovl_s16(vget_high_s16(vd_low_s16x8));
69  int32x4_t C_s32x4 = vmovl_s16(vget_low_s16(vd_high_s16x8));
70  int32x4_t D_s32x4 = vmovl_s16(vget_high_s16(vd_high_s16x8));
71  // Convert int32 vectors to float32 vectors
72  float32x4_t A_f32x4 = vcvtq_f32_s32(A_s32x4);
73  float32x4_t B_f32x4 = vcvtq_f32_s32(B_s32x4);
74  float32x4_t C_f32x4 = vcvtq_f32_s32(C_s32x4);
75  float32x4_t D_f32x4 = vcvtq_f32_s32(D_s32x4);
76  // vd = vd*vs + vo
77  A_f32x4 = vmlaq_f32(vo, A_f32x4, vs);
78  B_f32x4 = vmlaq_f32(vo, B_f32x4, vs);
79  C_f32x4 = vmlaq_f32(vo, C_f32x4, vs);
80  D_f32x4 = vmlaq_f32(vo, D_f32x4, vs);
81  // Convert float32 vectors to int32 vectors
82  A_s32x4 = vcvtq_s32_f32(A_f32x4);
83  B_s32x4 = vcvtq_s32_f32(B_f32x4);
84  C_s32x4 = vcvtq_s32_f32(C_f32x4);
85  D_s32x4 = vcvtq_s32_f32(D_f32x4);
86  // Convert int32 vectors to int16 vectors (with saturation)
87  vd_low_s16x8 = vcombine_s16(vqmovn_s32(A_s32x4), vqmovn_s32(B_s32x4));
88  vd_high_s16x8 = vcombine_s16(vqmovn_s32(C_s32x4), vqmovn_s32(D_s32x4));
89  // convert int16 vectors to int8 vectors (with saturation)
90  return vcombine_s8(vqmovn_s16(vd_low_s16x8), vqmovn_s16(vd_high_s16x8));
91 }

◆ vpowq_f32()

float32x4_t arm_compute::vpowq_f32 ( float32x4_t  val,
float32x4_t  n 
)

Calculate n power of a number.

pow(x,n) = e^(n*log(x))

Parameters
[in]valInput vector value in F32 format.
[in]nPowers to raise the input to.
Returns
The calculated power.

◆ vquantize() [1/2]

uint8x8_t arm_compute::vquantize ( const float32x4x2_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Quantize a neon vector holding 8 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the quantized values

Definition at line 602 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

Referenced by arm_compute::cpu::neon_qasymm8_activation(), CpuConcatenateWidthKernel::run_op(), and CpuConcatenateHeightKernel::run_op().

603 {
604  const float scale = qi.scale;
605  const int offset = qi.offset;
606  const float32x4_t voffset = vdupq_n_f32(offset);
607  const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
608  const int32x4x4_t rf =
609  {
610  {
611 #ifdef __aarch64__
612  vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
613  vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
614 #else //__aarch64__
615  vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
616  vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
617 #endif //__aarch64__
618  }
619  };
620  return vqmovun_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])));
621 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vquantize() [2/2]

uint8x16_t arm_compute::vquantize ( const float32x4x4_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Quantize a neon vector holding 16 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the quantized values

Definition at line 681 of file NEAsymm.h.

References UniformQuantizationInfo::offset, UniformQuantizationInfo::scale, and vquantize_internal().

682 {
683  auto rf = vquantize_internal(qv, qi.scale, qi.offset);
684  const uint8x8_t pa = vqmovun_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])));
685  const uint8x8_t pb = vqmovun_s16(vcombine_s16(vqmovn_s32(rf.val[2]), vqmovn_s32(rf.val[3])));
686  return vcombine_u8(pa, pb);
687 }
int32x4x4_t vquantize_internal(const float32x4x4_t &qv, float scale, int32_t offset)
Definition: NEAsymm.h:651

◆ vquantize_int16()

int16x8_t arm_compute::vquantize_int16 ( const float32x4x2_t &  qv,
float  scale 
)
inline

Quantize a neon vector holding 8 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]scaleQuantization scale
Returns
A neon vector holding the quantized values

Definition at line 155 of file NESymm.h.

Referenced by arm_compute::cpu::neon_qsymm16_activation().

156 {
157  const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
158 
159  const int32x4x2_t rf =
160  {
161  {
162 #ifdef __aarch64__
163  vcvtnq_s32_f32(vmulq_f32(qv.val[0], vinvscale)),
164  vcvtnq_s32_f32(vmulq_f32(qv.val[1], vinvscale))
165 #else //__aarch64__
166  vcvtq_s32_f32(vmulq_f32(qv.val[0], vinvscale)),
167  vcvtq_s32_f32(vmulq_f32(qv.val[1], vinvscale))
168 #endif //__aarch64__
169  }
170  };
171  return vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1]));
172 }

◆ vquantize_internal()

int32x4x4_t arm_compute::vquantize_internal ( const float32x4x4_t &  qv,
float  scale,
int32_t  offset 
)
inline

Definition at line 651 of file NEAsymm.h.

Referenced by vquantize(), vquantize_qasymm16(), and vquantize_signed().

652 {
653  const int32x4_t voffset = vdupq_n_s32(offset);
654  const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
655  const int32x4x4_t rf =
656  {
657  {
658 #ifdef __aarch64__
659  vaddq_s32(vcvtaq_s32_f32(vmulq_f32(qv.val[0], vinvscale)), voffset),
660  vaddq_s32(vcvtaq_s32_f32(vmulq_f32(qv.val[1], vinvscale)), voffset),
661  vaddq_s32(vcvtaq_s32_f32(vmulq_f32(qv.val[2], vinvscale)), voffset),
662  vaddq_s32(vcvtaq_s32_f32(vmulq_f32(qv.val[3], vinvscale)), voffset),
663 #else //__aarch64__
664  vaddq_s32(vcvtq_s32_f32(vmulq_f32(qv.val[0], vinvscale)), voffset),
665  vaddq_s32(vcvtq_s32_f32(vmulq_f32(qv.val[1], vinvscale)), voffset),
666  vaddq_s32(vcvtq_s32_f32(vmulq_f32(qv.val[2], vinvscale)), voffset),
667  vaddq_s32(vcvtq_s32_f32(vmulq_f32(qv.val[3], vinvscale)), voffset),
668 #endif //__aarch64__
669  }
670  };
671  return rf;
672 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vquantize_qasymm16()

uint16x8x2_t arm_compute::vquantize_qasymm16 ( const float32x4x4_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Quantize to QASYMM16 a neon vector holding 16 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the quantized values

Definition at line 711 of file NEAsymm.h.

References UniformQuantizationInfo::offset, UniformQuantizationInfo::scale, and vquantize_internal().

Referenced by CpuQuantizeKernel::validate().

712 {
713  auto rf = vquantize_internal(qv, qi.scale, qi.offset);
714  const uint16x8_t pa = vcombine_u16(vqmovun_s32(rf.val[0]), vqmovun_s32(rf.val[1]));
715  const uint16x8_t pb = vcombine_u16(vqmovun_s32(rf.val[2]), vqmovun_s32(rf.val[3]));
716  return { pa, pb };
717 }
int32x4x4_t vquantize_internal(const float32x4x4_t &qv, float scale, int32_t offset)
Definition: NEAsymm.h:651

◆ vquantize_qsymm16()

qsymm16x8x2_t arm_compute::vquantize_qsymm16 ( const float32x4x4_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Quantize a neon vector holding 16 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the quantized values

Definition at line 204 of file NESymm.h.

References ARM_COMPUTE_ERROR_ON, UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

205 {
206  const float scale = qi.scale;
207  ARM_COMPUTE_ERROR_ON(scale == 0.f);
208  const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
209  const int32x4x4_t rf =
210  {
211  {
212 #ifdef __aarch64__
213  vcvtnq_s32_f32(vmulq_f32(qv.val[0], vinvscale)),
214  vcvtnq_s32_f32(vmulq_f32(qv.val[1], vinvscale)),
215  vcvtnq_s32_f32(vmulq_f32(qv.val[2], vinvscale)),
216  vcvtnq_s32_f32(vmulq_f32(qv.val[3], vinvscale)),
217 #else //__aarch64__
218  vcvtq_s32_f32(vmulq_f32(qv.val[0], vinvscale)),
219  vcvtq_s32_f32(vmulq_f32(qv.val[1], vinvscale)),
220  vcvtq_s32_f32(vmulq_f32(qv.val[2], vinvscale)),
221  vcvtq_s32_f32(vmulq_f32(qv.val[3], vinvscale)),
222 #endif //__aarch64__
223  }
224  };
225  const qsymm16x8x2_t res =
226  {
227  vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])),
228  vcombine_s16(vqmovn_s32(rf.val[2]), vqmovn_s32(rf.val[3])),
229  };
230 
231  return res;
232 }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
int16x8x2_t qsymm16x8x2_t
16 bit quantized symmetric vector with 16 elements
Definition: NESymm.h:37

◆ vquantize_signed() [1/2]

int8x8_t arm_compute::vquantize_signed ( const float32x4x2_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Quantize a neon vector holding 8 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the singed quantized values

Definition at line 630 of file NEAsymm.h.

References UniformQuantizationInfo::offset, offset(), UniformQuantizationInfo::scale, and arm_compute::test::validation::scale.

Referenced by arm_compute::cpu::neon_qasymm8_signed_activation(), CpuConcatenateWidthKernel::run_op(), and CpuConcatenateHeightKernel::run_op().

631 {
632  const float scale = qi.scale;
633  const int offset = qi.offset;
634  const float32x4_t voffset = vdupq_n_f32(offset);
635  const float32x4_t vinvscale = vdupq_n_f32(1.f / scale);
636  const int32x4x4_t rf =
637  {
638  {
639 #ifdef __aarch64__
640  vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
641  vcvtnq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
642 #else //__aarch64__
643  vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[0], vinvscale)),
644  vcvtq_s32_f32(vmlaq_f32(voffset, qv.val[1], vinvscale)),
645 #endif //__aarch64__
646  }
647  };
648  return vqmovn_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])));
649 }
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
Definition: helpers.h:1084

◆ vquantize_signed() [2/2]

int8x16_t arm_compute::vquantize_signed ( const float32x4x4_t &  qv,
const UniformQuantizationInfo qi 
)
inline

Signed quantize a neon vector holding 16 floating point values.

Parameters
[in]qvInput values to be quantized.
[in]qiQuantization information to be used in the computation.
Returns
A neon vector holding the quantized values

Definition at line 696 of file NEAsymm.h.

References UniformQuantizationInfo::offset, UniformQuantizationInfo::scale, and vquantize_internal().

697 {
698  auto rf = vquantize_internal(qv, qi.scale, qi.offset);
699  const int8x8_t pa = vqmovn_s16(vcombine_s16(vqmovn_s32(rf.val[0]), vqmovn_s32(rf.val[1])));
700  const int8x8_t pb = vqmovn_s16(vcombine_s16(vqmovn_s32(rf.val[2]), vqmovn_s32(rf.val[3])));
701  return vcombine_s8(pa, pb);
702 }
int32x4x4_t vquantize_internal(const float32x4x4_t &qv, float scale, int32_t offset)
Definition: NEAsymm.h:651

◆ vreduce()

float vreduce ( const float32x4_t &  v)
inline

Reduce a vector to be a scalar by accumulating all lanes in the vector.

Parameters
[in]vVector to be reduced.
Returns
the wrapped-around number.

Definition at line 458 of file NEMath.inl.

References A, arm_compute::test::validation::b, B, C1, C2, C3, vadd_f16(), vaddq_f16(), vbslq_f16(), vcgtq_f16(), vcvtq_f16_s16(), vcvtq_s16_f16(), verfq_f32(), vexpq_f32(), vlogq_f32(), vmul_f16(), vmulq_f16(), vrecpe_f16(), vrecpeq_f16(), vrecps_f16(), vrecpsq_f16(), vrsqrte_f16(), vrsqrteq_f16(), vrsqrts_f16(), vrsqrtsq_f16(), vsin_f32(), vsinq_f32(), and vsubq_f16().

Referenced by arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), and arm_compute::cpu::directconv3d_float_neon_ndhwc().

459 {
460  const float32x2_t v0 = vget_high_f32(v);
461  const float32x2_t v1 = vget_low_f32(v);
462  const float32x2_t v_out = vadd_f32(v0, v1);
463 
464  const float a = vget_lane_f32(v_out, 0);
465  const float b = vget_lane_f32(v_out, 1);
466 
467  return a + b;
468 }
SimpleTensor< float > b
Definition: DFT.cpp:157

◆ vroundq_rte_f32()

float32x4_t arm_compute::vroundq_rte_f32 ( float32x4_t  val)

Calculate round value of a vector to nearest with ties to even.

Parameters
[in]valInput vector value in F32 format.
Returns
The calculated round vector.

◆ vsin_f32()

float32x2_t arm_compute::vsin_f32 ( float32x2_t  val)

Calculate sine.

Parameters
[in]valInput vector value in radians, F32 format.
Returns
The calculated sine.

Referenced by vreduce().

◆ vsinq_f32()

float32x4_t arm_compute::vsinq_f32 ( float32x4_t  val)

Calculate sine.

Parameters
[in]valInput vector value in radians, F32 format.
Returns
The calculated sine.

Referenced by vreduce().

◆ vtanhq_f32()

float32x4_t arm_compute::vtanhq_f32 ( float32x4_t  val)

Calculate hyperbolic tangent.

tanh(x) = (e^2x - 1)/(e^2x + 1)

Note
We clamp x to [-5,5] to avoid overflowing issues.
Parameters
[in]valInput vector value in F32 format.
Returns
The calculated Hyperbolic Tangent.

◆ vtaylor_polyq_f32()

float32x4_t arm_compute::vtaylor_polyq_f32 ( float32x4_t  x,
const std::array< float32x4_t, 8 > &  coeffs 
)

Perform a 7th degree polynomial approximation using Estrin's method.

Parameters
[in]xInput vector value in F32 format.
[in]coeffsPolynomial coefficients table.
Returns
The calculated approximation.

◆ wrap_around()

Variable Documentation

◆ exp_tab

const std::array<float32x4_t, 8> exp_tab
Initial value:
=
{
{
vdupq_n_f32(1.f),
vdupq_n_f32(0.0416598916054f),
vdupq_n_f32(0.500000596046f),
vdupq_n_f32(0.0014122662833f),
vdupq_n_f32(1.00000011921f),
vdupq_n_f32(0.00833693705499f),
vdupq_n_f32(0.166665703058f),
vdupq_n_f32(0.000195780929062f),
}
}

Exponent polynomial coefficients.

Definition at line 32 of file NEMath.inl.

◆ log_tab

const std::array<float32x4_t, 8> log_tab
Initial value:
=
{
{
vdupq_n_f32(-2.29561495781f),
vdupq_n_f32(-2.47071170807f),
vdupq_n_f32(-5.68692588806f),
vdupq_n_f32(-0.165253549814f),
vdupq_n_f32(5.17591238022f),
vdupq_n_f32(0.844007015228f),
vdupq_n_f32(4.58445882797f),
vdupq_n_f32(0.0141278216615f),
}
}

Logarithm polynomial coefficients.

Definition at line 47 of file NEMath.inl.

◆ MAX_DIMS

constexpr size_t MAX_DIMS = 6

Constant value used to indicate maximum dimensions of a Window, TensorShape and Coordinates.

Definition at line 38 of file Dimensions.h.

Referenced by arm_compute::misc::shape_calculator::calculate_concatenate_shape().

◆ te_sin_coeff2

constexpr float te_sin_coeff2 = 0.166666666666f

Sin polynomial coefficients.

Definition at line 62 of file NEMath.inl.

◆ te_sin_coeff3

constexpr float te_sin_coeff3 = 0.05f

Definition at line 63 of file NEMath.inl.

◆ te_sin_coeff4

constexpr float te_sin_coeff4 = 0.023809523810f

Definition at line 64 of file NEMath.inl.

◆ te_sin_coeff5

constexpr float te_sin_coeff5 = 0.013888888889f

Definition at line 65 of file NEMath.inl.