1 /* 2 * Copyright (C) 2020 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 #ifndef ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_COMMON_UTILS_H 18 #define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_COMMON_UTILS_H 19 20 #include <nnapi/Result.h> 21 #include <nnapi/SharedMemory.h> 22 #include <nnapi/Types.h> 23 24 #include <functional> 25 #include <vector> 26 27 // Shorthands 28 namespace android::hardware::neuralnetworks { 29 namespace hal = ::android::hardware::neuralnetworks; 30 } // namespace android::hardware::neuralnetworks 31 32 // Shorthands 33 namespace aidl::android::hardware::neuralnetworks { 34 namespace aidl_hal = ::aidl::android::hardware::neuralnetworks; 35 namespace hal = ::android::hardware::neuralnetworks; 36 namespace nn = ::android::nn; 37 } // namespace aidl::android::hardware::neuralnetworks 38 39 // Shorthands 40 namespace android::nn { 41 namespace hal = ::android::hardware::neuralnetworks; 42 namespace aidl_hal = ::aidl::android::hardware::neuralnetworks; 43 } // namespace android::nn 44 45 namespace android::hardware::neuralnetworks::utils { 46 47 nn::Capabilities::OperandPerformanceTable makeQuantized8PerformanceConsistentWithP( 48 const nn::Capabilities::PerformanceInfo& float32Performance, 49 const nn::Capabilities::PerformanceInfo& quantized8Performance); 50 51 using nn::convertRequestFromPointerToShared; 52 using nn::flushDataFromPointerToShared; 53 using nn::hasNoPointerData; 54 using nn::RequestRelocation; 55 56 } // namespace android::hardware::neuralnetworks::utils 57 58 #endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_COMMON_UTILS_H 59