1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NEURAL_NETWORK_RUNTIME_CPP_API_TYPE_H 17 #define NEURAL_NETWORK_RUNTIME_CPP_API_TYPE_H 18 19 #include <vector> 20 #include <string> 21 #include <memory> 22 23 #include "interfaces/kits/c/neural_network_runtime_type.h" 24 25 namespace OHOS { 26 namespace NeuralNetworkRuntime { 27 // ALLOCATE_BUFFER_LIMIT is 1 Gb 28 const size_t ALLOCATE_BUFFER_LIMIT = 1024 * 1024 * 1024; 29 enum DeviceStatus: int { 30 UNKNOWN, 31 AVAILABLE, 32 BUSY, 33 OFFLINE 34 }; 35 36 struct ModelConfig { 37 bool enableFloat16; 38 OH_NN_PerformanceMode mode; 39 OH_NN_Priority priority; 40 }; 41 42 struct ModelBuffer { 43 void* buffer; 44 size_t length; 45 }; 46 47 struct QuantParam { 48 uint32_t numBits; 49 double scale; 50 int32_t zeroPoint; 51 }; 52 53 struct IOTensor { 54 std::string name; 55 OH_NN_DataType dataType; 56 OH_NN_Format format; 57 std::vector<int> dimensions; 58 void* data; 59 size_t length; 60 }; 61 } // NeuralNetworkRuntime 62 } // OHOS 63 64 #endif // NEURAL_NETWORK_RUNTIME_CPP_API_TYPE_H