diff options
Diffstat (limited to 'runtimes/nn/depend/hal/include/android/hardware/neuralnetworks/1.0/types.h')
-rw-r--r-- | runtimes/nn/depend/hal/include/android/hardware/neuralnetworks/1.0/types.h | 493 |
1 files changed, 0 insertions, 493 deletions
diff --git a/runtimes/nn/depend/hal/include/android/hardware/neuralnetworks/1.0/types.h b/runtimes/nn/depend/hal/include/android/hardware/neuralnetworks/1.0/types.h deleted file mode 100644 index 146d18d2a..000000000 --- a/runtimes/nn/depend/hal/include/android/hardware/neuralnetworks/1.0/types.h +++ /dev/null @@ -1,493 +0,0 @@ -#ifndef HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_0_TYPES_H -#define HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_0_TYPES_H - -#include <hidl/HidlSupport.h> -#if 0 // REF-ANN -#include <hidl/MQDescriptor.h> -#include <utils/NativeHandle.h> -#include <utils/misc.h> -#endif - -namespace android { -namespace hardware { -namespace neuralnetworks { -namespace V1_0 { - -enum class OperandType : int32_t { - FLOAT32 = 0, - INT32 = 1, - UINT32 = 2, - TENSOR_FLOAT32 = 3, - TENSOR_INT32 = 4, - TENSOR_QUANT8_ASYMM = 5, - OEM = 10000, - TENSOR_OEM_BYTE = 10001, -}; - -enum class OperationType : int32_t { - ADD = 0, - AVERAGE_POOL_2D = 1, - CONCATENATION = 2, - CONV_2D = 3, - DEPTHWISE_CONV_2D = 4, - DEPTH_TO_SPACE = 5, - DEQUANTIZE = 6, - EMBEDDING_LOOKUP = 7, - FLOOR = 8, - FULLY_CONNECTED = 9, - HASHTABLE_LOOKUP = 10, - L2_NORMALIZATION = 11, - L2_POOL_2D = 12, - LOCAL_RESPONSE_NORMALIZATION = 13, - LOGISTIC = 14, - LSH_PROJECTION = 15, - LSTM = 16, - MAX_POOL_2D = 17, - MUL = 18, - RELU = 19, - RELU1 = 20, - RELU6 = 21, - RESHAPE = 22, - RESIZE_BILINEAR = 23, - RNN = 24, - SOFTMAX = 25, - SPACE_TO_DEPTH = 26, - SVDF = 27, - TANH = 28, - OEM_OPERATION = 10000, -}; - -enum class FusedActivationFunc : int32_t { - NONE = 0, - RELU = 1, - RELU1 = 2, - RELU6 = 3, -}; - -enum class OperandLifeTime : int32_t { - TEMPORARY_VARIABLE = 0, - MODEL_INPUT = 1, - MODEL_OUTPUT = 2, - CONSTANT_COPY = 3, - CONSTANT_REFERENCE = 4, - NO_VALUE = 5, -}; - -enum class DeviceStatus : int32_t { - AVAILABLE = 0, - BUSY = 1, - OFFLINE = 2, - UNKNOWN = 3, -}; - -struct PerformanceInfo final { - float execTime __attribute__ ((aligned(4))); - float powerUsage __attribute__ ((aligned(4))); -}; - -static_assert(offsetof(PerformanceInfo, execTime) == 0, "wrong offset"); -static_assert(offsetof(PerformanceInfo, powerUsage) == 4, "wrong offset"); -static_assert(sizeof(PerformanceInfo) == 8, "wrong size"); -static_assert(__alignof(PerformanceInfo) == 4, "wrong alignment"); - -struct Capabilities final { - PerformanceInfo float32Performance __attribute__ ((aligned(4))); - PerformanceInfo quantized8Performance __attribute__ ((aligned(4))); -}; - -static_assert(offsetof(Capabilities, float32Performance) == 0, "wrong offset"); -static_assert(offsetof(Capabilities, quantized8Performance) == 8, "wrong offset"); -static_assert(sizeof(Capabilities) == 16, "wrong size"); -static_assert(__alignof(Capabilities) == 4, "wrong alignment"); - -struct DataLocation final { - uint32_t poolIndex __attribute__ ((aligned(4))); - uint32_t offset __attribute__ ((aligned(4))); - uint32_t length __attribute__ ((aligned(4))); -}; - -static_assert(offsetof(DataLocation, poolIndex) == 0, "wrong offset"); -static_assert(offsetof(DataLocation, offset) == 4, "wrong offset"); -static_assert(offsetof(DataLocation, length) == 8, "wrong offset"); -static_assert(sizeof(DataLocation) == 12, "wrong size"); -static_assert(__alignof(DataLocation) == 4, "wrong alignment"); - -struct Operand final { - OperandType type __attribute__ ((aligned(4))); - ::android::hardware::hidl_vec<uint32_t> dimensions __attribute__ ((aligned(8))); - uint32_t numberOfConsumers __attribute__ ((aligned(4))); - float scale __attribute__ ((aligned(4))); - int32_t zeroPoint __attribute__ ((aligned(4))); - OperandLifeTime lifetime __attribute__ ((aligned(4))); - DataLocation location __attribute__ ((aligned(4))); -}; - -static_assert(offsetof(Operand, type) == 0, "wrong offset"); -static_assert(offsetof(Operand, dimensions) == 8, "wrong offset"); -static_assert(offsetof(Operand, numberOfConsumers) == 24, "wrong offset"); -static_assert(offsetof(Operand, scale) == 28, "wrong offset"); -static_assert(offsetof(Operand, zeroPoint) == 32, "wrong offset"); -static_assert(offsetof(Operand, lifetime) == 36, "wrong offset"); -static_assert(offsetof(Operand, location) == 40, "wrong offset"); -static_assert(sizeof(Operand) == 56, "wrong size"); -static_assert(__alignof(Operand) == 8, "wrong alignment"); - -struct Operation final { - OperationType type __attribute__ ((aligned(4))); - ::android::hardware::hidl_vec<uint32_t> inputs __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<uint32_t> outputs __attribute__ ((aligned(8))); -}; - -static_assert(offsetof(Operation, type) == 0, "wrong offset"); -static_assert(offsetof(Operation, inputs) == 8, "wrong offset"); -static_assert(offsetof(Operation, outputs) == 24, "wrong offset"); -static_assert(sizeof(Operation) == 40, "wrong size"); -static_assert(__alignof(Operation) == 8, "wrong alignment"); - -struct Model final { - ::android::hardware::hidl_vec<Operand> operands __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<Operation> operations __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<uint32_t> inputIndexes __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<uint32_t> outputIndexes __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<uint8_t> operandValues __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<::android::hardware::hidl_memory> pools __attribute__ ((aligned(8))); -}; - -static_assert(offsetof(Model, operands) == 0, "wrong offset"); -static_assert(offsetof(Model, operations) == 16, "wrong offset"); -static_assert(offsetof(Model, inputIndexes) == 32, "wrong offset"); -static_assert(offsetof(Model, outputIndexes) == 48, "wrong offset"); -static_assert(offsetof(Model, operandValues) == 64, "wrong offset"); -static_assert(offsetof(Model, pools) == 80, "wrong offset"); -static_assert(sizeof(Model) == 96, "wrong size"); -static_assert(__alignof(Model) == 8, "wrong alignment"); - -struct RequestArgument final { - bool hasNoValue __attribute__ ((aligned(1))); - DataLocation location __attribute__ ((aligned(4))); - ::android::hardware::hidl_vec<uint32_t> dimensions __attribute__ ((aligned(8))); -}; - -static_assert(offsetof(RequestArgument, hasNoValue) == 0, "wrong offset"); -static_assert(offsetof(RequestArgument, location) == 4, "wrong offset"); -static_assert(offsetof(RequestArgument, dimensions) == 16, "wrong offset"); -static_assert(sizeof(RequestArgument) == 32, "wrong size"); -static_assert(__alignof(RequestArgument) == 8, "wrong alignment"); - -struct Request final { - ::android::hardware::hidl_vec<RequestArgument> inputs __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<RequestArgument> outputs __attribute__ ((aligned(8))); - ::android::hardware::hidl_vec<::android::hardware::hidl_memory> pools __attribute__ ((aligned(8))); -}; - -static_assert(offsetof(Request, inputs) == 0, "wrong offset"); -static_assert(offsetof(Request, outputs) == 16, "wrong offset"); -static_assert(offsetof(Request, pools) == 32, "wrong offset"); -static_assert(sizeof(Request) == 48, "wrong size"); -static_assert(__alignof(Request) == 8, "wrong alignment"); - -enum class ErrorStatus : int32_t { - NONE = 0, - DEVICE_UNAVAILABLE = 1, - GENERAL_FAILURE = 2, - OUTPUT_INSUFFICIENT_SIZE = 3, - INVALID_ARGUMENT = 4, -}; - -constexpr int32_t operator|(const OperandType lhs, const OperandType rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const OperandType rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const OperandType lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const OperandType lhs, const OperandType rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const OperandType rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const OperandType lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const OperandType e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const OperandType e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<OperandType>(int32_t o); - -std::string toString(OperandType o); - -constexpr int32_t operator|(const OperationType lhs, const OperationType rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const OperationType rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const OperationType lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const OperationType lhs, const OperationType rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const OperationType rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const OperationType lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const OperationType e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const OperationType e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<OperationType>(int32_t o); - -std::string toString(OperationType o); - -constexpr int32_t operator|(const FusedActivationFunc lhs, const FusedActivationFunc rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const FusedActivationFunc rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const FusedActivationFunc lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const FusedActivationFunc lhs, const FusedActivationFunc rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const FusedActivationFunc rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const FusedActivationFunc lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const FusedActivationFunc e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const FusedActivationFunc e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<FusedActivationFunc>(int32_t o); - -std::string toString(FusedActivationFunc o); - -constexpr int32_t operator|(const OperandLifeTime lhs, const OperandLifeTime rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const OperandLifeTime rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const OperandLifeTime lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const OperandLifeTime lhs, const OperandLifeTime rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const OperandLifeTime rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const OperandLifeTime lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const OperandLifeTime e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const OperandLifeTime e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<OperandLifeTime>(int32_t o); - -std::string toString(OperandLifeTime o); - -constexpr int32_t operator|(const DeviceStatus lhs, const DeviceStatus rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const DeviceStatus rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const DeviceStatus lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const DeviceStatus lhs, const DeviceStatus rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const DeviceStatus rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const DeviceStatus lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const DeviceStatus e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const DeviceStatus e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<DeviceStatus>(int32_t o); - -std::string toString(DeviceStatus o); - -std::string toString(const PerformanceInfo&); - -bool operator==(const PerformanceInfo&, const PerformanceInfo&); - -bool operator!=(const PerformanceInfo&, const PerformanceInfo&); - -std::string toString(const Capabilities&); - -bool operator==(const Capabilities&, const Capabilities&); - -bool operator!=(const Capabilities&, const Capabilities&); - -std::string toString(const DataLocation&); - -bool operator==(const DataLocation&, const DataLocation&); - -bool operator!=(const DataLocation&, const DataLocation&); - -std::string toString(const Operand&); - -bool operator==(const Operand&, const Operand&); - -bool operator!=(const Operand&, const Operand&); - -std::string toString(const Operation&); - -bool operator==(const Operation&, const Operation&); - -bool operator!=(const Operation&, const Operation&); - -std::string toString(const Model&); - -// operator== and operator!= are not generated for Model - -std::string toString(const RequestArgument&); - -bool operator==(const RequestArgument&, const RequestArgument&); - -bool operator!=(const RequestArgument&, const RequestArgument&); - -std::string toString(const Request&); - -// operator== and operator!= are not generated for Request - -constexpr int32_t operator|(const ErrorStatus lhs, const ErrorStatus rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const int32_t lhs, const ErrorStatus rhs) { - return static_cast<int32_t>(lhs | static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator|(const ErrorStatus lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) | rhs); -} - -constexpr int32_t operator&(const ErrorStatus lhs, const ErrorStatus rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const int32_t lhs, const ErrorStatus rhs) { - return static_cast<int32_t>(lhs & static_cast<int32_t>(rhs)); -} - -constexpr int32_t operator&(const ErrorStatus lhs, const int32_t rhs) { - return static_cast<int32_t>(static_cast<int32_t>(lhs) & rhs); -} - -constexpr int32_t &operator|=(int32_t& v, const ErrorStatus e) { - v |= static_cast<int32_t>(e); - return v; -} - -constexpr int32_t &operator&=(int32_t& v, const ErrorStatus e) { - v &= static_cast<int32_t>(e); - return v; -} - -template<typename> -std::string toString(int32_t o); -template<> -std::string toString<ErrorStatus>(int32_t o); - -std::string toString(ErrorStatus o); - - -} // namespace V1_0 -} // namespace neuralnetworks -} // namespace hardware -} // namespace android - -#endif // HIDL_GENERATED_ANDROID_HARDWARE_NEURALNETWORKS_V1_0_TYPES_H |