1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "Operations.h" 18 #include "OperationsUtils.h" 19 20 #include "internal/optimized/optimized_ops.h" 21 22 namespace android { 23 namespace nn { 24 25 bool l2normFloat32(const float* inputData, const Shape& inputShape, 26 float* outputData, const Shape& outputShape) { 27 optimized_ops::L2Normalization<FusedActivationFunctionType::kNone>( 28 inputData, convertShapeToDims(inputShape), 29 outputData, convertShapeToDims(outputShape)); 30 31 return true; 32 } 33 34 bool l2normQuant8(const uint8_t* inputData, const Shape& inputShape, 35 uint8_t* outputData, const Shape& outputShape) { 36 optimized_ops::L2Normalization( 37 inputData, convertShapeToDims(inputShape), 38 inputShape.offset, 39 outputData, convertShapeToDims(outputShape)); 40 41 return true; 42 } 43 44 bool localResponseNormFloat32(const float* inputData, const Shape& inputShape, 45 int32_t radius, float bias, float alpha, float beta, 46 float* outputData, const Shape& outputShape) { 47 optimized_ops::LocalResponseNormalization( 48 inputData, convertShapeToDims(inputShape), 49 radius, bias, alpha, beta, 50 outputData, convertShapeToDims(outputShape)); 51 52 return true; 53 } 54 } // namespace nn 55 } // namespace android 56