/aosp12/packages/modules/NeuralNetworks/common/operations/ |
H A D | L2Normalization.cpp | 53 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in l2normFloat32Impl() 55 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in l2normFloat32Impl() 80 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in l2normQuant8Impl() 82 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in l2normQuant8Impl() 114 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in l2normQuant8SignedImpl() 141 int32_t ndim = getNumberOfDimensions(inputShape); in l2normFloat32() 142 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in l2normFloat32() 170 int32_t ndim = getNumberOfDimensions(inputShape); in l2normQuant8() 171 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in l2normQuant8() 186 int32_t ndim = getNumberOfDimensions(inputShape); in l2normQuant8Signed() [all …]
|
H A D | Reshape.cpp | 34 bool copyData(const void* inputData, const Shape& inputShape, void* outputData, in copyData() argument 37 size_t count = nonExtensionOperandSizeOfData(inputShape.type, inputShape.dimensions); in copyData() 43 bool depthToSpaceGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, in depthToSpaceGeneric() argument 50 template bool depthToSpaceGeneric<float>(const float* inputData, const Shape& inputShape, 64 bool spaceToDepthGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, in spaceToDepthGeneric() argument 94 int32_t numInputDims = static_cast<int32_t>(getNumberOfDimensions(inputShape)); in padGeneric() 112 tflite::RuntimeShape::ExtendedShape(4, convertShapeToTflshape(inputShape)); in padGeneric() 184 template bool padGeneric<float>(const float* inputData, const Shape& inputShape, 187 template bool padGeneric<_Float16>(const _Float16* inputData, const Shape& inputShape, 190 template bool padGeneric<uint8_t>(const uint8_t* inputData, const Shape& inputShape, [all …]
|
H A D | Activation.cpp | 56 int numElements = getNumberOfElements(inputShape); in reluFloat() 92 int numElements = getNumberOfElements(inputShape); in tanhFloat16() 102 int numElements = getNumberOfElements(inputShape); in tanhFloat32() 113 int numElements = getNumberOfElements(inputShape); in logisticFloat() 127 int numElements = getNumberOfElements(inputShape); in reluXQuant8() 167 int numElements = getNumberOfElements(inputShape); in tanhQuant8() 182 tflite::optimized_ops::Tanh(inputData, convertShapeToTflshape(inputShape), inputShape.offset, in tanhQuant8() 197 int numElements = getNumberOfElements(inputShape); in logisticQuant8() 213 inputData, convertShapeToTflshape(inputShape), inputShape.offset, input_range_radius, in logisticQuant8() 331 params.input_zero_point = inputShape.offset; in hardSwishQuant() [all …]
|
H A D | Dequantize.cpp | 37 const int numElements = getNumberOfElements(inputShape); in compute() 38 const int32_t zeroPoint = inputShape.offset; in compute() 39 const float scale = inputShape.scale; in compute() 56 stride *= getSizeOfDimension(inputShape, i); in computePerChannel() 59 const int numElements = getNumberOfElements(inputShape); in computePerChannel() 60 const int32_t zeroPoint = inputShape.offset; in computePerChannel() 125 return compute(inputBuffer, inputShape, in execute() 133 return compute(inputBuffer, inputShape, in execute() 141 return compute(inputBuffer, inputShape, in execute() 149 return computePerChannel(inputBuffer, inputShape, in execute() [all …]
|
H A D | Split.cpp | 29 bool splitGeneric(const Scalar* inputData, const Shape& inputShape, int32_t axis, in splitGeneric() argument 32 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in splitGeneric() 35 outerSize *= inputShape.dimensions[i]; in splitGeneric() 38 int concatDimensions = getNumberOfDimensions(inputShape); in splitGeneric() 40 baseInnerSize *= inputShape.dimensions[i]; in splitGeneric() 55 bool splitFloat16(const _Float16* inputData, const Shape& inputShape, int32_t axis, in splitFloat16() argument 62 bool splitFloat32(const float* inputData, const Shape& inputShape, int32_t axis, in splitFloat32() argument 66 return splitGeneric<float>(inputData, inputShape, axis, outputDataPtrs, outputShapes); in splitFloat32() 69 bool splitQuant8(const uint8_t* inputData, const Shape& inputShape, int32_t axis, in splitQuant8() argument 76 bool splitQuant8Signed(const int8_t* inputData, const Shape& inputShape, int32_t axis, in splitQuant8Signed() argument [all …]
|
H A D | Softmax.cpp | 56 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in softmaxSlowFloat32() 57 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in softmaxSlowFloat32() 59 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in softmaxSlowFloat32() 87 int32_t ndim = getNumberOfDimensions(inputShape); in softmaxFloat32() 88 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in softmaxFloat32() 131 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in softmaxQuant8Impl() 132 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in softmaxQuant8Impl() 134 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in softmaxQuant8Impl() 205 int32_t ndim = getNumberOfDimensions(inputShape); in softmaxQuant8() 206 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in softmaxQuant8() [all …]
|
H A D | Pooling.cpp | 81 Shape inputShape = context->getInputShape(kInputTensor); in initialize() local 82 int32_t input_height = getSizeOfDimension(inputShape, useNchw ? 2 : 1); in initialize() 83 int32_t input_width = getSizeOfDimension(inputShape, useNchw ? 3 : 2); in initialize() 154 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in averagePoolNhwc() 158 averagePoolNhwc(inputDataFloat32.data(), inputShape, param, outputDataFloat32.data(), in averagePoolNhwc() 200 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in l2PoolNhwc() 244 std::vector<float> inputData_float32(getNumberOfElements(inputShape)); in maxPoolNhwc() 248 maxPoolNhwc(inputData_float32.data(), inputShape, param, outputData_float32.data(), in maxPoolNhwc() 259 NN_RET_CHECK(input.initialize(inputData, inputShape)); in averagePool() 272 NN_RET_CHECK(input.initialize(inputData, inputShape)); in l2Pool() [all …]
|
H A D | SimpleMath.cpp | 33 bool meanFloat16(_Float16* inputData, const Shape& inputShape, const int32_t* axis, in meanFloat16() argument 37 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in meanFloat16() 41 meanGeneric<float, float>(inputDataFloat32.data(), inputShape, axis, axisShape, keepDims, in meanFloat16() 48 bool meanGeneric(T* inputData, const Shape& inputShape, const int32_t* axis, const Shape& axisShape, in meanGeneric() argument 52 int32_t* scratchBuffer = new int32_t[getNumberOfDimensions(inputShape)]; in meanGeneric() 66 inputData, reinterpret_cast<const int*>(inputShape.dimensions.data()), in meanGeneric() 67 getNumberOfDimensions(inputShape), outputData, in meanGeneric() 77 template bool meanGeneric<float, float>(float* inputData, const Shape& inputShape, 80 template bool meanGeneric<uint8_t, int32_t>(uint8_t* inputData, const Shape& inputShape, 84 template bool meanGeneric<int8_t, int32_t>(int8_t* inputData, const Shape& inputShape,
|
H A D | ArgMinMax.cpp | 29 static void argMinMaxImpl(const In* inputData, const Shape& inputShape, int32_t axis, bool isArgMin, in argMinMaxImpl() argument 31 const int outerSize = getNumberOfElements(inputShape, 0, axis); in argMinMaxImpl() 32 const int axisSize = getSizeOfDimension(inputShape, axis); in argMinMaxImpl() 34 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in argMinMaxImpl() 51 bool argMinMaxGeneric(const uint8_t* inputData, const Shape& inputShape, int32 axis, bool isArgMin, in argMinMaxGeneric() argument 54 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in argMinMaxGeneric() 57 if (inputShape.type == operandType) { \ in argMinMaxGeneric() 59 argMinMaxImpl(reinterpret_cast<const dataType*>(inputData), inputShape, axis, isArgMin, \ in argMinMaxGeneric()
|
H A D | LocalResponseNormalization.cpp | 51 inline bool localResponseNormFloat32Impl(const float* inputData, const Shape& inputShape, in localResponseNormFloat32Impl() argument 56 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in localResponseNormFloat32Impl() 57 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in localResponseNormFloat32Impl() 59 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in localResponseNormFloat32Impl() 86 bool localResponseNorm<float>(const float* inputData, const Shape& inputShape, int32_t radius, 89 int32_t ndim = getNumberOfDimensions(inputShape); 90 NN_CHECK(handleNegativeAxis(inputShape, &axis)); 91 radius = std::min(radius, static_cast<int32_t>(inputShape.dimensions[axis])); 98 param, convertShapeToTflshape(inputShape), inputData, 112 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); [all …]
|
H A D | UnidirectionalSequenceRNN.cpp | 50 const uint32_t firstDimSize = getSizeOfDimension(inputShape, 0); in transposeFirstTwoDims() 52 const uint32_t inputSize = getSizeOfDimension(inputShape, 2); in transposeFirstTwoDims() 67 Shape inputShape = context->getInputShape(kInputTensor); in executeTyped() local 87 inputTransposed.resize(getNumberOfElements(inputShape)); in executeTyped() 92 std::swap(inputShape.dimensions[0], inputShape.dimensions[1]); in executeTyped() 96 const uint32_t maxTime = getSizeOfDimension(inputShape, 0); in executeTyped() 97 const uint32_t batchSize = getSizeOfDimension(inputShape, 1); in executeTyped() 98 const uint32_t inputSize = getSizeOfDimension(inputShape, 2); in executeTyped() 102 Shape fixedTimeInputShape = inputShape; in executeTyped() 104 fixedTimeInputShape.dimensions[0] = inputShape.dimensions[1]; in executeTyped() [all …]
|
H A D | TopK_V2.cpp | 41 bool evalGeneric(const T* inputData, const Shape& inputShape, const int32_t k, T* valuesData, in evalGeneric() argument 43 const int rowSize = inputShape.dimensions.back(); in evalGeneric() 44 const int totalSize = getNumberOfElements(inputShape); in evalGeneric() 96 const Shape inputShape = context->getInputShape(kInputTensor); in prepare() local 99 NN_RET_CHECK_LE(k, inputShape.dimensions.back()); in prepare() 103 Shape outputValuesShape = inputShape; in prepare() 107 outputIndicesShape.dimensions = inputShape.dimensions; in prepare() 114 const Shape inputShape = context->getInputShape(kInputTensor); in execute() local 115 switch (inputShape.type) { in execute() 132 LOG(ERROR) << "Unsupported data type: " << inputShape.type; in execute()
|
H A D | Conv2D.cpp | 233 int32_t inputOffset = -inputShape.offset; in convNhwc() 287 inputShape.offset += 128; in convNhwc() 341 NN_RET_CHECK(input.initialize(inputData, inputShape)); in conv() 362 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in convQuant8PerChannelNhwc() 364 uint32_t inputWidth = getSizeOfDimension(inputShape, 2); in convQuant8PerChannelNhwc() 365 uint32_t inputDepth = getSizeOfDimension(inputShape, 3); in convQuant8PerChannelNhwc() 373 int32_t inputOffset = -inputShape.offset; in convQuant8PerChannelNhwc() 455 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in convQuant8PerChannelNhwc() 466 int32_t inputOffset = -inputShape.offset; in convQuant8PerChannelNhwc() 488 convParams.input_offset = -inputShape.offset; in convQuant8PerChannelNhwc() [all …]
|
H A D | GroupedConv2D.cpp | 34 uint32_t numBatches = getSizeOfDimension(inputShape, 0); \ 35 uint32_t inputHeight = getSizeOfDimension(inputShape, 1); \ 36 uint32_t inputWidth = getSizeOfDimension(inputShape, 2); \ 37 uint32_t inputDepth = getSizeOfDimension(inputShape, 3); \ 113 int32_t inputOffset = -inputShape.offset; in groupedConvQuant8() 200 bool groupedConvQuant8PerChannel(const T* inputData, const Shape& inputShape, in groupedConvQuant8PerChannel() argument 210 int32_t inputOffset = -inputShape.offset; in groupedConvQuant8PerChannel() 221 biasChannelShape.scale = filterScales[i] * inputShape.scale; in groupedConvQuant8PerChannel() 285 bool groupedConvFloat16(const _Float16* inputData, const Shape& inputShape, in groupedConvFloat16() argument 293 std::vector<float> inputData_float32(getNumberOfElements(inputShape)); in groupedConvFloat16() [all …]
|
H A D | FullyConnected.cpp | 56 bool fullyConnectedFloat32(const float* inputData, const Shape& inputShape, in fullyConnectedFloat32() argument 67 uint32_t input_n_elements = getNumberOfElements(inputShape); in fullyConnectedFloat32() 70 tflite::reference_ops::FullyConnected(inputData, convertShapeToDims(inputShape), in fullyConnectedFloat32() 77 tflite::optimized_ops::FullyConnected(inputData, convertShapeToDims(inputShape), in fullyConnectedFloat32() 86 bool fullyConnectedFloat16(const _Float16* inputData, const Shape& inputShape, in fullyConnectedFloat16() argument 91 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in fullyConnectedFloat16() 107 bool fullyConnectedQuant8(const uint8_t* inputData, const Shape& inputShape, in fullyConnectedQuant8() argument 112 int32_t inputOffset = -inputShape.offset; in fullyConnectedQuant8() 148 bool fullyConnectedQuant8(const int8_t* inputData, const Shape& inputShape, in fullyConnectedQuant8() argument 167 params.input_offset = -inputShape.offset; in fullyConnectedQuant8() [all …]
|
H A D | RNN.cpp | 68 const Shape& inputShape = input->shape(); in Prepare() local 71 hiddenStateShape->type = inputShape.type; in Prepare() 75 outputShape->type = inputShape.type; in Prepare() 116 bool RNN::RNNStep(const T* inputData, const Shape& inputShape, const T* hiddenStateInputData, in RNNStep() argument 136 bool RNN::RNNStep(const T* inputData, const Shape& inputShape, const T* auxInputData, in RNNStep() argument 145 const uint32_t batch_size = inputShape.dimensions[0]; in RNNStep() 147 const uint32_t input_size = inputShape.dimensions[1]; in RNNStep() 223 template bool RNN::RNNStep<_Float16>(const _Float16* inputData, const Shape& inputShape, 229 template bool RNN::RNNStep<_Float16>(const _Float16* inputData, const Shape& inputShape, 239 template bool RNN::RNNStep<float>(const float* inputData, const Shape& inputShape, [all …]
|
H A D | ChannelShuffle.cpp | 38 inline bool eval(const T* inputData, const Shape& inputShape, int32_t numGroups, int32_t axis, in eval() argument 40 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in eval() 41 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in eval() 43 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in eval() 69 const Shape& inputShape = context->getInputShape(kInputTensor); in validate() local 70 if (hasKnownRank(inputShape)) { in validate() 71 NN_RET_CHECK_LE(getNumberOfDimensions(inputShape), 4); in validate()
|
H A D | DepthwiseConv2D.cpp | 123 uint32_t height = getSizeOfDimension(inputShape, 1); \ 124 uint32_t width = getSizeOfDimension(inputShape, 2); \ 226 .input_offset = -inputShape.offset, in depthwiseConvNhwc() 255 inputShape.offset += 128; in depthwiseConvNhwc() 289 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in depthwiseConvQuant8PerChannelNhwc() 290 uint32_t inputHeight = getSizeOfDimension(inputShape, 1); in depthwiseConvQuant8PerChannelNhwc() 291 uint32_t inputWidth = getSizeOfDimension(inputShape, 2); in depthwiseConvQuant8PerChannelNhwc() 292 uint32_t inputDepth = getSizeOfDimension(inputShape, 3); in depthwiseConvQuant8PerChannelNhwc() 300 int32_t inputOffset = -inputShape.offset; in depthwiseConvQuant8PerChannelNhwc() 382 NN_RET_CHECK(input.initialize(inputData, inputShape)); in depthwiseConv() [all …]
|
H A D | Squeeze.cpp | 76 const Shape inputShape = context->getInputShape(kInputTensor); in prepare() local 78 int32_t numInputDims = static_cast<int32_t>(getNumberOfDimensions(inputShape)); in prepare() 80 NN_RET_CHECK_LE(getNumberOfDimensions(inputShape), 4); in prepare() 92 if (getSizeOfDimension(inputShape, idx) == 1) { in prepare() 103 getSizeOfDimension(inputShape, current) == 1); in prepare() 117 outDims[outIdx++] = getSizeOfDimension(inputShape, inIdx); in prepare() 121 Shape outputShape(inputShape); in prepare()
|
H A D | Cast.cpp | 72 bool eval(const uint8_t* inputData, const Shape& inputShape, uint8_t* outputData, in eval() argument 75 int numElements = getNumberOfElements(inputShape); in eval() 85 switch (inputShape.type) { in eval() 91 if (inputShape.type == outputShape.type) { in eval() 92 return copyData(inputData, inputShape, outputData, outputShape); in eval()
|
H A D | ResizeImageOps.cpp | 68 bool resizeNearestNeighbor(const T* inputData, const Shape& inputShape, bool alignCorners, in resizeNearestNeighbor() argument 70 const int batchSize = getSizeOfDimension(inputShape, 0); in resizeNearestNeighbor() 71 const int inHeight = getSizeOfDimension(inputShape, 1); in resizeNearestNeighbor() 72 const int inWidth = getSizeOfDimension(inputShape, 2); in resizeNearestNeighbor() 73 const int channels = getSizeOfDimension(inputShape, 3); in resizeNearestNeighbor() 111 bool resizeImageOpNhwc(OperationType opType, const T* inputData, const Shape& inputShape, in resizeImageOpNhwc() argument 126 convertShapeToTflshape(inputShape), inputData, convertShapeToTflshape(outDimShape), in resizeImageOpNhwc() 131 resizeNearestNeighbor(inputData, inputShape, alignCorners, halfPixelCenters, outputData, in resizeImageOpNhwc() 142 std::vector<float> inputData_float32(getNumberOfElements(inputShape)); 145 NN_RET_CHECK(resizeImageOpNhwc(opType, inputData_float32.data(), inputShape, alignCorners, [all …]
|
H A D | InstanceNormalization.cpp | 49 inline bool instanceNormNhwc(const T* inputData, const Shape& inputShape, T gamma, T beta, in instanceNormNhwc() argument 52 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in instanceNormNhwc() 53 uint32_t height = getSizeOfDimension(inputShape, 1); in instanceNormNhwc() 54 uint32_t width = getSizeOfDimension(inputShape, 2); in instanceNormNhwc() 55 uint32_t depth = getSizeOfDimension(inputShape, 3); in instanceNormNhwc() 92 inline bool instanceNorm(const T* inputData, const Shape& inputShape, T gamma, T beta, T epsilon, in instanceNorm() argument 96 NN_RET_CHECK(input.initialize(inputData, inputShape)); in instanceNorm()
|
H A D | Slice.cpp | 53 bool evalGeneric(const T* inputData, const Shape& inputShape, const int32_t* beginData, in evalGeneric() argument 58 const IndexedShapeWrapper indexedInput = IndexedShapeWrapper(inputShape); in evalGeneric() 61 std::vector<uint32_t> inputIndex(getNumberOfDimensions(inputShape)); in evalGeneric() 111 const Shape& inputShape = context->getInputShape(kInputTensor); in prepare() local 112 const int32_t n_dims = getNumberOfDimensions(inputShape); in prepare() 132 sliceSize = getSizeOfDimension(inputShape, i) - sliceBegin; in prepare() 134 NN_RET_CHECK_LE(beginData[i], getSizeOfDimension(inputShape, i)); in prepare() 136 NN_RET_CHECK_LE(sliceBegin + sliceSize, getSizeOfDimension(inputShape, i)); in prepare()
|
H A D | RoiPooling.cpp | 55 inline bool roiPoolingNhwc(const T_Input* inputData, const Shape& inputShape, const T_Roi* roiData, in roiPoolingNhwc() argument 65 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in roiPoolingNhwc() 66 uint32_t inHeight = getSizeOfDimension(inputShape, 1); in roiPoolingNhwc() 67 uint32_t inWidth = getSizeOfDimension(inputShape, 2); in roiPoolingNhwc() 68 uint32_t inDepth = getSizeOfDimension(inputShape, 3); in roiPoolingNhwc() 123 T_Input maxValue = static_cast<T_Input>(inputShape.offset); in roiPoolingNhwc() 144 inline bool roiPooling(const T_Input* inputData, const Shape& inputShape, const T_Roi* roiData, in roiPooling() argument 150 NN_RET_CHECK(input.initialize(inputData, inputShape)); in roiPooling() 160 inline bool roiPooling<uint8_t, uint16_t>(const uint8_t* inputData, const Shape& inputShape, 168 NN_RET_CHECK(roiPooling(inputData, inputShape, roi_float32.data(), roiShape, batchSplitData, [all …]
|
/aosp12/packages/modules/NeuralNetworks/common/include/ |
H A D | Operations.h | 52 bool depthwiseConvFloat16(const _Float16* inputData, const Shape& inputShape, 66 bool depthwiseConvQuant8(const uint8_t* inputData, const Shape& inputShape, 73 bool depthwiseConvQuant8PerChannel(const uint8_t* inputData, const Shape& inputShape, 90 bool copyData(const void* inputData, const Shape& inputShape, void* outputData, 113 bool meanFloat16(_Float16* inputData, const Shape& inputShape, const int32_t* axis, 120 bool stridedSliceGeneric(const uint8_t* inputData, const Shape& inputShape, 125 bool argMinMaxGeneric(const uint8_t* inputData, const Shape& inputShape, int32_t axis, 128 bool splitFloat16(const _Float16* inputData, const Shape& inputShape, int32_t axis, 132 bool splitFloat32(const float* inputData, const Shape& inputShape, const int32_t axis, 148 bool groupedConvFloat16(const _Float16* inputData, const Shape& inputShape, [all …]
|