/frameworks/ml/nn/common/operations/ |
D | Dequantize.cpp | 37 bool compute(const InputType* inputData, const Shape& inputShape, OutputType* outputData) { in compute() argument 38 const int numElements = getNumberOfElements(inputShape); in compute() 39 const int32_t zeroPoint = inputShape.offset; in compute() 40 const float scale = inputShape.scale; in compute() 49 bool computePerChannel(const int8_t* inputData, const Shape& inputShape, OutputType* outputData) { in computePerChannel() argument 53 const int channelDim = inputShape.extraParams.channelQuant().channelDim; in computePerChannel() 55 for (int i = getNumberOfDimensions(inputShape) - 1; i > channelDim; --i) { in computePerChannel() 56 stride *= getSizeOfDimension(inputShape, i); in computePerChannel() 59 const int numElements = getNumberOfElements(inputShape); in computePerChannel() 60 const int32_t zeroPoint = inputShape.offset; in computePerChannel() [all …]
|
D | Reshape.cpp | 32 bool copyData(const void* inputData, const Shape& inputShape, void* outputData, in copyData() argument 35 size_t count = nonExtensionOperandSizeOfData(inputShape.type, inputShape.dimensions); in copyData() 41 bool depthToSpaceGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, in depthToSpaceGeneric() argument 44 tflite::optimized_ops::DepthToSpace(inputData, convertShapeToDims(inputShape), blockSize, in depthToSpaceGeneric() 48 template bool depthToSpaceGeneric<float>(const float* inputData, const Shape& inputShape, 51 template bool depthToSpaceGeneric<_Float16>(const _Float16* inputData, const Shape& inputShape, 54 template bool depthToSpaceGeneric<uint8_t>(const uint8_t* inputData, const Shape& inputShape, 59 bool spaceToDepthGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, in spaceToDepthGeneric() argument 62 tflite::optimized_ops::SpaceToDepth(inputData, convertShapeToDims(inputShape), blockSize, in spaceToDepthGeneric() 66 template bool spaceToDepthGeneric<float>(const float* inputData, const Shape& inputShape, [all …]
|
D | Split.cpp | 28 bool splitGeneric(const Scalar* inputData, const Shape& inputShape, int32_t axis, in splitGeneric() argument 31 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in splitGeneric() 34 outerSize *= inputShape.dimensions[i]; in splitGeneric() 37 int concatDimensions = getNumberOfDimensions(inputShape); in splitGeneric() 39 baseInnerSize *= inputShape.dimensions[i]; in splitGeneric() 54 bool splitFloat16(const _Float16* inputData, const Shape& inputShape, int32_t axis, in splitFloat16() argument 58 return splitGeneric<_Float16>(inputData, inputShape, axis, outputDataPtrs, outputShapes); in splitFloat16() 61 bool splitFloat32(const float* inputData, const Shape& inputShape, int32_t axis, in splitFloat32() argument 65 return splitGeneric<float>(inputData, inputShape, axis, outputDataPtrs, outputShapes); in splitFloat32() 68 bool splitQuant8(const uint8_t* inputData, const Shape& inputShape, int32_t axis, in splitQuant8() argument [all …]
|
D | L2Normalization.cpp | 39 inline bool l2normFloat32Impl(const float* inputData, const Shape& inputShape, int32_t axis, in l2normFloat32Impl() argument 42 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in l2normFloat32Impl() 43 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in l2normFloat32Impl() 45 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in l2normFloat32Impl() 66 inline bool l2normQuant8Impl(const uint8_t* inputData, const Shape& inputShape, int32_t axis, in l2normQuant8Impl() argument 69 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in l2normQuant8Impl() 70 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in l2normQuant8Impl() 72 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in l2normQuant8Impl() 80 int32_t val = static_cast<int32_t>(*p) - inputShape.offset; in l2normQuant8Impl() 87 int32_t val = static_cast<int32_t>(*p) - inputShape.offset; in l2normQuant8Impl() [all …]
|
D | Activation.cpp | 40 bool reluFloat(const T* inputData, const Shape& inputShape, T* outputData, const Shape& outputShape, in reluFloat() argument 43 int numElements = getNumberOfElements(inputShape); in reluFloat() 50 template bool reluFloat<float>(const float* inputData, const Shape& inputShape, float* outputData, 52 template bool reluFloat<_Float16>(const _Float16* inputData, const Shape& inputShape, 57 bool relu1Float(const T* inputData, const Shape& inputShape, T* outputData, in relu1Float() argument 59 return reluFloat(inputData, inputShape, outputData, outputShape, -1.f, 1.f); in relu1Float() 61 template bool relu1Float<float>(const float* inputData, const Shape& inputShape, float* outputData, 63 template bool relu1Float<_Float16>(const _Float16* inputData, const Shape& inputShape, 67 bool relu6Float(const T* inputData, const Shape& inputShape, T* outputData, in relu6Float() argument 69 return reluFloat(inputData, inputShape, outputData, outputShape, 0.f, 6.f); in relu6Float() [all …]
|
D | Normalization.cpp | 29 inline bool localResponseNormFloat32Impl(const float* inputData, const Shape& inputShape, in localResponseNormFloat32Impl() argument 34 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in localResponseNormFloat32Impl() 35 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in localResponseNormFloat32Impl() 37 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in localResponseNormFloat32Impl() 59 bool localResponseNormFloat16(const _Float16* inputData, const Shape& inputShape, int32_t radius, in localResponseNormFloat16() argument 63 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in localResponseNormFloat16() 67 localResponseNormFloat32(inputDataFloat32.data(), inputShape, radius, bias, alpha, beta, axis, in localResponseNormFloat16() 74 bool localResponseNormFloat32(const float* inputData, const Shape& inputShape, int32_t radius, in localResponseNormFloat32() argument 77 int32_t ndim = getNumberOfDimensions(inputShape); in localResponseNormFloat32() 78 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in localResponseNormFloat32() [all …]
|
D | ArgMinMax.cpp | 30 static void argMinMaxImpl(const In* inputData, const Shape& inputShape, in argMinMaxImpl() argument 33 const int outerSize = getNumberOfElements(inputShape, 0, axis); in argMinMaxImpl() 34 const int axisSize = getSizeOfDimension(inputShape, axis); in argMinMaxImpl() 36 inputShape, axis + 1, getNumberOfDimensions(inputShape)); in argMinMaxImpl() 55 bool argMinMaxGeneric(const uint8_t* inputData, const Shape& inputShape, in argMinMaxGeneric() argument 59 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in argMinMaxGeneric() 62 if (inputShape.type == operandType) { \ in argMinMaxGeneric() 66 inputShape, \ in argMinMaxGeneric()
|
D | Softmax.cpp | 42 inline bool softmaxSlowFloat32(const float* inputData, const Shape& inputShape, const float beta, in softmaxSlowFloat32() argument 45 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in softmaxSlowFloat32() 46 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in softmaxSlowFloat32() 48 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in softmaxSlowFloat32() 74 bool softmaxFloat32(const float* inputData, const Shape& inputShape, const float beta, int32_t axis, in softmaxFloat32() argument 76 int32_t ndim = getNumberOfDimensions(inputShape); in softmaxFloat32() 77 NN_CHECK(handleNegativeAxis(inputShape, &axis)); in softmaxFloat32() 82 tflite::optimized_ops::Softmax(param, convertShapeToTflshape(inputShape), inputData, in softmaxFloat32() 86 return softmaxSlowFloat32(inputData, inputShape, beta, axis, outputData, outputShape); in softmaxFloat32() 90 bool softmaxFloat16(const _Float16* inputData, const Shape& inputShape, const float beta, in softmaxFloat16() argument [all …]
|
D | TopK_V2.cpp | 29 bool evalGeneric(const T* inputData, const Shape& inputShape, const int32_t k, T* valuesData, in evalGeneric() argument 32 const int rowSize = inputShape.dimensions.back(); in evalGeneric() 33 const int totalSize = getNumberOfElements(inputShape); in evalGeneric() 67 bool eval(const void* inputData, const Shape& inputShape, const int32_t k, void* valuesData, in eval() argument 69 switch (inputShape.type) { in eval() 71 return evalGeneric(reinterpret_cast<const _Float16*>(inputData), inputShape, k, in eval() 76 return evalGeneric(reinterpret_cast<const float*>(inputData), inputShape, k, in eval() 81 return evalGeneric(reinterpret_cast<const int32_t*>(inputData), inputShape, k, in eval() 86 return evalGeneric(reinterpret_cast<const uint8_t*>(inputData), inputShape, k, in eval() 91 LOG(ERROR) << "Unsupported data type: " << toString(inputShape.type); in eval()
|
D | Pooling.cpp | 71 Shape inputShape = context->getInputShape(kInputTensor); in initialize() local 72 int32_t input_height = getSizeOfDimension(inputShape, useNchw ? 2 : 1); in initialize() 73 int32_t input_width = getSizeOfDimension(inputShape, useNchw ? 3 : 2); in initialize() 121 bool averagePoolNhwc(const float* inputData, const Shape& inputShape, const PoolingParam& param, in averagePoolNhwc() argument 126 tflite::optimized_ops::AveragePool(op_params, convertShapeToTflshape(inputShape), inputData, in averagePoolNhwc() 131 bool averagePoolNhwc(const _Float16* inputData, const Shape& inputShape, const PoolingParam& param, in averagePoolNhwc() argument 134 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in averagePoolNhwc() 138 averagePoolNhwc(inputDataFloat32.data(), inputShape, param, outputDataFloat32.data(), in averagePoolNhwc() 144 bool averagePoolNhwc(const uint8_t* inputData, const Shape& inputShape, const PoolingParam& param, in averagePoolNhwc() argument 149 tflite::optimized_ops::AveragePool(op_params, convertShapeToTflshape(inputShape), inputData, in averagePoolNhwc() [all …]
|
D | DepthwiseConv2D.cpp | 28 bool depthwiseConvFloat16(const _Float16* inputData, const Shape& inputShape, in depthwiseConvFloat16() argument 36 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in depthwiseConvFloat16() 44 depthwiseConvFloat32(inputDataFloat32.data(), inputShape, filterDataFloat32.data(), filterShape, in depthwiseConvFloat16() 55 uint32_t height = getSizeOfDimension(inputShape, 1); \ 56 uint32_t width = getSizeOfDimension(inputShape, 2); \ 65 bool depthwiseConvFloat32(const float* inputData, const Shape& inputShape, const float* filterData, in depthwiseConvFloat32() argument 90 tflite::optimized_ops::DepthwiseConv(params, convertShapeToTflshape(inputShape), inputData, in depthwiseConvFloat32() 98 bool depthwiseConvQuant8(const uint8_t* inputData, const Shape& inputShape, in depthwiseConvQuant8() argument 115 NN_RET_CHECK(GetQuantizedConvolutionMultipler(inputShape, filterShape, biasShape, outputShape, in depthwiseConvQuant8() 132 .input_offset = -inputShape.offset, in depthwiseConvQuant8() [all …]
|
D | SimpleMath.cpp | 51 bool meanFloat16(_Float16* inputData, const Shape& inputShape, const int32_t* axis, in meanFloat16() argument 55 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in meanFloat16() 59 meanGeneric<float, float>(inputDataFloat32.data(), inputShape, axis, axisShape, keepDims, in meanFloat16() 66 bool meanGeneric(T* inputData, const Shape& inputShape, const int32_t* axis, const Shape& axisShape, in meanGeneric() argument 70 int32_t* scratchBuffer = new int32_t[getNumberOfDimensions(inputShape)]; in meanGeneric() 84 inputData, reinterpret_cast<const int*>(inputShape.dimensions.data()), in meanGeneric() 85 getNumberOfDimensions(inputShape), outputData, in meanGeneric() 95 template bool meanGeneric<float, float>(float* inputData, const Shape& inputShape, 98 template bool meanGeneric<uint8_t, int32_t>(uint8_t* inputData, const Shape& inputShape,
|
D | StridedSlice.cpp | 31 bool stridedSliceGeneric(const uint8_t* inputData, const Shape& inputShape, in stridedSliceGeneric() argument 44 int32_t numInputDims = static_cast<int32_t>(getNumberOfDimensions(inputShape)); in stridedSliceGeneric() 61 if (inputShape.type == OperandType::TENSOR_FLOAT32) { in stridedSliceGeneric() 64 reinterpret_cast<const float*>(inputData), convertShapeToDims(inputShape), in stridedSliceGeneric() 67 } else if (inputShape.type == OperandType::TENSOR_FLOAT16) { in stridedSliceGeneric() 70 reinterpret_cast<const _Float16*>(inputData), convertShapeToDims(inputShape), in stridedSliceGeneric() 73 } else if (inputShape.type == OperandType::TENSOR_QUANT8_ASYMM) { in stridedSliceGeneric() 76 reinterpret_cast<const uint8_t*>(inputData), convertShapeToDims(inputShape), in stridedSliceGeneric()
|
D | UnidirectionalSequenceRNN.cpp | 41 void transposeFirstTwoDims(const T* input, const Shape& inputShape, T* output) { in transposeFirstTwoDims() argument 42 const uint32_t firstDimSize = getSizeOfDimension(inputShape, 0); in transposeFirstTwoDims() 43 const uint32_t secondDimSize = getSizeOfDimension(inputShape, 1); in transposeFirstTwoDims() 44 const uint32_t inputSize = getSizeOfDimension(inputShape, 2); in transposeFirstTwoDims() 59 Shape inputShape = context->getInputShape(kInputTensor); in executeTyped() local 79 inputTransposed.resize(getNumberOfElements(inputShape)); in executeTyped() 81 transposeFirstTwoDims(input, inputShape, inputTransposed.data()); in executeTyped() 84 std::swap(inputShape.dimensions[0], inputShape.dimensions[1]); in executeTyped() 88 const uint32_t maxTime = getSizeOfDimension(inputShape, 0); in executeTyped() 89 const uint32_t batchSize = getSizeOfDimension(inputShape, 1); in executeTyped() [all …]
|
D | GroupedConv2D.cpp | 30 uint32_t numBatches = getSizeOfDimension(inputShape, 0); \ 31 uint32_t inputHeight = getSizeOfDimension(inputShape, 1); \ 32 uint32_t inputWidth = getSizeOfDimension(inputShape, 2); \ 33 uint32_t inputDepth = getSizeOfDimension(inputShape, 3); \ 42 bool groupedConvFloat32(const float* inputData, const Shape& inputShape, const float* filterData, in groupedConvFloat32() argument 99 bool groupedConvQuant8(const uint8_t* inputData, const Shape& inputShape, const uint8_t* filterData, in groupedConvQuant8() argument 108 int32_t inputOffset = -inputShape.offset; in groupedConvQuant8() 115 NN_RET_CHECK(GetQuantizedConvolutionMultipler(inputShape, filterShape, biasShape, outputShape, in groupedConvQuant8() 176 bool groupedConvQuant8PerChannel(const uint8_t* inputData, const Shape& inputShape, in groupedConvQuant8PerChannel() argument 187 int32_t inputOffset = -inputShape.offset; in groupedConvQuant8PerChannel() [all …]
|
D | Conv2D.cpp | 94 Shape inputShape = context->getInputShape(kInputTensor); in initialize() local 96 int32_t input_width = getSizeOfDimension(inputShape, useNchw ? 3 : 2); in initialize() 97 int32_t input_height = getSizeOfDimension(inputShape, useNchw ? 2 : 1); in initialize() 120 uint32_t height = getSizeOfDimension(inputShape, 1); \ 121 uint32_t width = getSizeOfDimension(inputShape, 2); \ 126 uint32_t inDepth = getSizeOfDimension(inputShape, 3); \ 164 bool convNhwc(const float* inputData, const Shape& inputShape, const float* filterData, in convNhwc() argument 180 tflite::optimized_ops::Conv(inputData, convertShapeToDims(inputShape), filterData, in convNhwc() 189 bool convNhwc(const uint8_t* inputData, const Shape& inputShape, const uint8_t* filterData, in convNhwc() argument 199 int32_t inputOffset = -inputShape.offset; in convNhwc() [all …]
|
D | FullyConnected.cpp | 47 bool fullyConnectedFloat32(const float* inputData, const Shape& inputShape, in fullyConnectedFloat32() argument 58 uint32_t input_n_elements = getNumberOfElements(inputShape); in fullyConnectedFloat32() 61 tflite::reference_ops::FullyConnected(inputData, convertShapeToDims(inputShape), in fullyConnectedFloat32() 68 tflite::optimized_ops::FullyConnected(inputData, convertShapeToDims(inputShape), in fullyConnectedFloat32() 77 bool fullyConnectedFloat16(const _Float16* inputData, const Shape& inputShape, in fullyConnectedFloat16() argument 82 std::vector<float> inputDataFloat32(getNumberOfElements(inputShape)); in fullyConnectedFloat16() 90 fullyConnectedFloat32(inputDataFloat32.data(), inputShape, weightsDataFloat32.data(), in fullyConnectedFloat16() 98 bool fullyConnectedQuant8(const uint8_t* inputData, const Shape& inputShape, in fullyConnectedQuant8() argument 103 int32_t inputOffset = -inputShape.offset; in fullyConnectedQuant8() 113 NN_RET_CHECK(GetQuantizedConvolutionMultipler(inputShape, weightsShape, biasShape, outputShape, in fullyConnectedQuant8() [all …]
|
D | Slice.cpp | 46 bool evalGeneric(const T* inputData, const Shape& inputShape, const int32_t* beginData, in evalGeneric() argument 51 const IndexedShapeWrapper indexedInput = IndexedShapeWrapper(inputShape); in evalGeneric() 54 std::vector<uint32_t> inputIndex(getNumberOfDimensions(inputShape)); in evalGeneric() 94 const Shape& inputShape = context->getInputShape(kInputTensor); in prepare() local 95 const int32_t n_dims = getNumberOfDimensions(inputShape); in prepare() 115 sliceSize = getSizeOfDimension(inputShape, i) - sliceBegin; in prepare() 117 NN_RET_CHECK_LE(beginData[i], getSizeOfDimension(inputShape, i)); in prepare() 119 NN_RET_CHECK_LE(sliceBegin + sliceSize, getSizeOfDimension(inputShape, i)); in prepare()
|
D | InstanceNormalization.cpp | 46 inline bool instanceNormNhwc(const T* inputData, const Shape& inputShape, T gamma, T beta, in instanceNormNhwc() argument 49 uint32_t numBatches = getSizeOfDimension(inputShape, 0); in instanceNormNhwc() 50 uint32_t height = getSizeOfDimension(inputShape, 1); in instanceNormNhwc() 51 uint32_t width = getSizeOfDimension(inputShape, 2); in instanceNormNhwc() 52 uint32_t depth = getSizeOfDimension(inputShape, 3); in instanceNormNhwc() 78 inline bool instanceNorm(const T* inputData, const Shape& inputShape, T gamma, T beta, T epsilon, in instanceNorm() argument 82 NN_RET_CHECK(input.initialize(inputData, inputShape)); in instanceNorm()
|
D | RNN.cpp | 72 const Shape &inputShape = input->shape(); in Prepare() local 75 hiddenStateShape->type = inputShape.type; in Prepare() 79 outputShape->type = inputShape.type; in Prepare() 120 bool RNN::RNNStep(const T* inputData, const Shape& inputShape, const T* hiddenStateInputData, in RNNStep() argument 128 return RNNStep<T>(inputData, inputShape, /*auxInputData=*/nullptr, /*auxInputShape=*/dummyShape, in RNNStep() 140 bool RNN::RNNStep(const T* inputData, const Shape& inputShape, const T* auxInputData, in RNNStep() argument 149 const uint32_t batch_size = inputShape.dimensions[0]; in RNNStep() 151 const uint32_t input_size = inputShape.dimensions[1]; in RNNStep()
|
D | Tile.cpp | 65 void tileImpl(const T* inputData, const Shape& inputShape, const int32_t* multiples, T* outputData, in tileImpl() argument 67 TileOneDimension(inputShape, inputData, multiples, outputData, 0); in tileImpl() 86 bool eval(const uint8_t* inputData, const Shape& inputShape, const int32_t* multiples, in eval() argument 92 tileImpl(reinterpret_cast<const dataType*>(inputData), inputShape, multiples, \ in eval() 97 switch (inputShape.type) { in eval()
|
D | ExpandDims.cpp | 40 bool eval(const uint8_t* inputData, const Shape& inputShape, int32_t axis, uint8_t* outputData, in eval() argument 43 nonExtensionOperandSizeOfData(inputShape.type, inputShape.dimensions)); in eval()
|
D | TransposeConv2D.cpp | 101 uint32_t numBatches = getSizeOfDimension(inputShape, 0); \ 102 uint32_t inputHeight = getSizeOfDimension(inputShape, 1); \ 103 uint32_t inputWidth = getSizeOfDimension(inputShape, 2); \ 104 uint32_t inputDepth = getSizeOfDimension(inputShape, 3); \ 115 bool transposeConvNhwc(const float* inputData, const Shape& inputShape, const float* filterData, in transposeConvNhwc() argument 171 bool transposeConvNhwc(const uint8_t* inputData, const Shape& inputShape, const uint8_t* filterData, in transposeConvNhwc() argument 192 int32_t inputOffset = -inputShape.offset; in transposeConvNhwc() 199 NN_RET_CHECK(GetQuantizedConvolutionMultipler(inputShape, filterShape, biasShape, outputShape, in transposeConvNhwc() 266 bool transposeConvNhwc(const _Float16* inputData, const Shape& inputShape, in transposeConvNhwc() argument 272 std::vector<float> inputData_float32(getNumberOfElements(inputShape)); in transposeConvNhwc() [all …]
|
D | ChannelShuffle.cpp | 39 inline bool eval(const T* inputData, const Shape& inputShape, int32_t numGroups, int32_t axis, in eval() argument 41 const uint32_t outerSize = getNumberOfElements(inputShape, 0, axis); in eval() 42 const uint32_t axisSize = getSizeOfDimension(inputShape, axis); in eval() 44 getNumberOfElements(inputShape, axis + 1, getNumberOfDimensions(inputShape)); in eval()
|
/frameworks/ml/nn/common/include/ |
D | Operations.h | 49 bool depthwiseConvFloat16(const _Float16* inputData, const Shape& inputShape, 56 bool depthwiseConvFloat32(const float* inputData, const Shape& inputShape, const float* filterData, 63 bool depthwiseConvQuant8(const uint8_t* inputData, const Shape& inputShape, 70 bool depthwiseConvQuant8PerChannel(const uint8_t* inputData, const Shape& inputShape, 80 bool localResponseNormFloat16(const _Float16* inputData, const Shape& inputShape, int32_t radius, 83 bool localResponseNormFloat32(const float* inputData, const Shape& inputShape, int32_t radius, 87 bool copyData(const void* inputData, const Shape& inputShape, void* outputData, 91 bool depthToSpaceGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, 94 bool spaceToDepthGeneric(const T* inputData, const Shape& inputShape, int32_t blockSize, 98 bool padGeneric(const T* inputData, const Shape& inputShape, const int32_t* paddings, T pad_value, [all …]
|