Merge "Add NNAPI 1.3 OperationType"

This commit is contained in:
Lev Proleev
2019-11-13 11:52:15 +00:00
committed by Android (Google) Code Review
6 changed files with 4588 additions and 49 deletions

View File

@@ -597,7 +597,7 @@ db47f4ceceb1f06c656f39caa70c557b0f8471ef59fd58611bea667ffca20101 android.hardwar
9e59fffceed0dd72a9799e04505db5f777bbbea1af0695ba4107ef6d967c6fda android.hardware.neuralnetworks@1.3::IDevice
4a6c3b3556da951b4def21ba579a227c022980fe4465df6cdfbe20628fa75f5a android.hardware.neuralnetworks@1.3::IPreparedModel
94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback
b74fe72cfe438f50e772e6a307657ff449d5bde83c15dd1f140ff2edbe73499c android.hardware.neuralnetworks@1.3::types
c511b1427b1c3f76af90967bbddaaf250db983a8d3abb9ff189fb5a807cf3d4d android.hardware.neuralnetworks@1.3::types
3e01d4446cd69fd1c48f8572efd97487bc179564b32bd795800b97bbe10be37b android.hardware.wifi@1.4::IWifi
a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
44445b8a03d7b9e68b2fbd954672c18a8fce9e32851b0692f4f4ab3407f86ecb android.hardware.wifi.supplicant@1.3::ISupplicantStaIface

File diff suppressed because it is too large Load Diff

View File

@@ -44,6 +44,47 @@ enum OperandTypeRange : uint32_t {
BASE_MAX = 0xFFFF,
};
/**
* Operation types.
*
* The type of an operation in a model.
*/
enum OperationType : int32_t {
%insert Operation_1.0
%insert Operation_1.1
%insert Operation_1.2
/**
* DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to
* OEM operation and data types.
*
* This operation is OEM specific. It should only be used for OEM
* applications.
*/
OEM_OPERATION = @1.2::OperationType:OEM_OPERATION,
/* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::FUNDAMENTAL_MAX.
*/
/* ADDING A NEW OEM OPERATION REQUIRES UPDATING THE VALUE OF
* OperationTypeRange::OEM_MAX.
*/
};
/**
* The range of values in the OperationType enum.
*/
enum OperationTypeRange : uint32_t {
BASE_MIN = 0,
FUNDAMENTAL_MIN = 0,
%insert Operation_1.3_MAX
OEM_MIN = 10000,
OEM_MAX = 10000,
BASE_MAX = 0xFFFF,
};
/**
* The capabilities of a driver.
@@ -79,6 +120,32 @@ struct Capabilities {
vec<OperandPerformance> operandPerformance;
};
/**
* Describes one operation of the model's graph.
*/
struct Operation {
/**
* The operation type.
*
* Besides the values listed in {@link OperationType}, any value above
* {@link OperationTypeRange::BASE_MAX} is possible and should be interpreted
* as an extension type according to {@link Model::extensionNameToPrefix}.
*/
OperationType type;
/**
* Describes the table that contains the indexes of the inputs of the
* operation. The offset is the index in the operandIndexes table.
*/
vec<uint32_t> inputs;
/**
* Describes the table that contains the indexes of the outputs of the
* operation. The offset is the index in the operandIndexes table.
*/
vec<uint32_t> outputs;
};
/**
* Describes one operand of the model's graph.
*/
@@ -203,28 +270,6 @@ struct Operand {
} extraParams;
};
/**
* Describes one operation of the model's graph.
*/
struct Operation {
/**
* The operation type.
*/
OperationType type;
/**
* Describes the table that contains the indexes of the inputs of the
* operation. The offset is the index in the operandIndexes table.
*/
vec<uint32_t> inputs;
/**
* Describes the table that contains the indexes of the outputs of the
* operation. The offset is the index in the operandIndexes table.
*/
vec<uint32_t> outputs;
};
/**
* A Neural Network Model.
*

View File

@@ -63,7 +63,6 @@ using V1_0::Request;
using V1_1::ExecutionPreference;
using V1_2::Constant;
using V1_2::MeasureTiming;
using V1_2::OperationType;
using V1_2::OutputShape;
using V1_2::SymmPerChannelQuantParams;
using V1_2::Timing;

View File

@@ -25,8 +25,6 @@ using namespace test_helper;
#define CHECK_TEST_ENUM(EnumType, enumValue) \
static_assert(static_cast<EnumType>(Test##EnumType::enumValue) == EnumType::enumValue)
using V1_2::OperationType;
CHECK_TEST_ENUM(OperandType, FLOAT32);
CHECK_TEST_ENUM(OperandType, INT32);
CHECK_TEST_ENUM(OperandType, UINT32);

View File

@@ -27,7 +27,6 @@ using implementation::PreparedModelCallback;
using V1_0::ErrorStatus;
using V1_0::OperandLifeTime;
using V1_1::ExecutionPreference;
using V1_2::OperationType;
using V1_2::OperationTypeRange;
using V1_2::SymmPerChannelQuantParams;
using HidlToken =