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_1_1_CONVERSIONS_H 18 #define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_1_CONVERSIONS_H 19 20 #include <android/hardware/neuralnetworks/1.1/types.h> 21 #include <nnapi/Result.h> 22 #include <nnapi/Types.h> 23 #include <nnapi/hal/CommonUtils.h> 24 25 namespace android::nn { 26 27 GeneralResult<OperationType> unvalidatedConvert(const hal::V1_1::OperationType& operationType); 28 GeneralResult<Capabilities> unvalidatedConvert(const hal::V1_1::Capabilities& capabilities); 29 GeneralResult<Operation> unvalidatedConvert(const hal::V1_1::Operation& operation); 30 GeneralResult<Model> unvalidatedConvert(const hal::V1_1::Model& model); 31 GeneralResult<ExecutionPreference> unvalidatedConvert( 32 const hal::V1_1::ExecutionPreference& executionPreference); 33 34 GeneralResult<Capabilities> convert(const hal::V1_1::Capabilities& capabilities); 35 GeneralResult<Model> convert(const hal::V1_1::Model& model); 36 GeneralResult<ExecutionPreference> convert( 37 const hal::V1_1::ExecutionPreference& executionPreference); 38 39 } // namespace android::nn 40 41 namespace android::hardware::neuralnetworks::V1_1::utils { 42 43 nn::GeneralResult<OperationType> unvalidatedConvert(const nn::OperationType& operationType); 44 nn::GeneralResult<Capabilities> unvalidatedConvert(const nn::Capabilities& capabilities); 45 nn::GeneralResult<Operation> unvalidatedConvert(const nn::Operation& operation); 46 nn::GeneralResult<Model> unvalidatedConvert(const nn::Model& model); 47 nn::GeneralResult<ExecutionPreference> unvalidatedConvert( 48 const nn::ExecutionPreference& executionPreference); 49 50 nn::GeneralResult<Capabilities> convert(const nn::Capabilities& capabilities); 51 nn::GeneralResult<Model> convert(const nn::Model& model); 52 nn::GeneralResult<ExecutionPreference> convert(const nn::ExecutionPreference& executionPreference); 53 54 nn::GeneralResult<V1_0::DeviceStatus> convert(const nn::DeviceStatus& deviceStatus); 55 nn::GeneralResult<V1_0::Request> convert(const nn::Request& request); 56 nn::GeneralResult<V1_0::ErrorStatus> convert(const nn::ErrorStatus& status); 57 58 } // namespace android::hardware::neuralnetworks::V1_1::utils 59 60 #endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_1_1_CONVERSIONS_H 61