1 // Copyright (C) 2020 by Yuri Victorovich. All rights reserved. 2 3 #pragma once 4 5 #include "tensor.h" 6 7 #include <array> 8 9 namespace NnOperators { 10 11 void Conv2D( 12 const TensorShape &inputShape, const float *inputData, 13 const TensorShape &filterShape, const float *filterData, 14 const TensorShape &biasShape, const float *biasData, 15 const TensorShape &outputShape, float *outputData, 16 unsigned paddingWidth, unsigned paddingHeight, 17 unsigned strideWidth, unsigned strideHeight, 18 unsigned dilationWidthFactor, unsigned dilationHeightFactor 19 ); 20 21 void DepthwiseConv2D( 22 const TensorShape &inputShape, const float *inputData, 23 const TensorShape &filterShape, const float *filterData, 24 const TensorShape &biasShape, const float *biasData, 25 const TensorShape &outputShape, float *outputData, 26 unsigned paddingWidth, unsigned paddingHeight, 27 unsigned strideWidth, unsigned strideHeight, 28 unsigned dilationWidthFactor, unsigned dilationHeightFactor, 29 unsigned depthMultiplier 30 ); 31 32 void FullyConnected( 33 const TensorShape &inputShape, const float *inputData, 34 const TensorShape &filterShape, const float *filterData, 35 const TensorShape &biasShape, const float *biasData, 36 const TensorShape &outputShape, float *outputData 37 ); 38 39 void MaxPool( 40 const TensorShape &inputShape, const float *inputData, 41 const TensorShape &outputShape, float *outputData, 42 unsigned paddingWidth, unsigned paddingHeight, 43 unsigned strideWidth, unsigned strideHeight, 44 unsigned filterWidth, unsigned filterHeight 45 ); 46 47 void AveragePool( 48 const TensorShape &inputShape, const float *inputData, 49 const TensorShape &outputShape, float *outputData, 50 unsigned paddingWidth, unsigned paddingHeight, 51 unsigned strideWidth, unsigned strideHeight, 52 unsigned filterWidth, unsigned filterHeight 53 ); 54 55 void Softmax( 56 const TensorShape &inputShape, const float *inputData, 57 const TensorShape &outputShape, float *outputData, 58 float beta 59 ); 60 61 void ResizeBilinear( 62 const TensorShape &inputShape, const float *inputData, 63 const TensorShape &outputShape, float *outputData, 64 bool alignCorners 65 ); 66 67 void ResizeNearestNeighbor( 68 const TensorShape &inputShape, const float *inputData, 69 const TensorShape &outputShape, float *outputData, 70 bool alignCorners 71 ); 72 73 void LocalResponseNormalization( 74 const TensorShape &inputShape, const float *inputData, 75 const TensorShape &outputShape, float *outputData, 76 int radius, float alpha, float beta, float bias 77 ); 78 79 void Mean( 80 const TensorShape &inputShape, const float *inputData, 81 const TensorShape &outputShape, float *outputData, 82 const int32_t *axis, unsigned axis_count 83 ); 84 85 void Pad( 86 const std::array<int32_t,2>* paddings, 87 const TensorShape &inputShape, const float *inputData, 88 const TensorShape &outputShape, float *outputData 89 ); 90 91 } 92