Loading current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -623,10 +623,10 @@ bbeee9604128ede83ee755b67e73b5ad29e6e1dbac9ec41fea6ffe2745b0c50a android.hardwar adb0efdf1462e9b2e742c0dcadd598666aac551f178be06e755bfcdf5797abd0 android.hardware.keymaster@4.1::IOperation ac429fca0da4ce91218768ec31b64ded88251f8a26d8c4f27c06abdc5b1926d9 android.hardware.keymaster@4.1::types 4b5c8546533db9412fec6d32c0ef42b22e5e68dbf390c775ec3c22bb2d501102 android.hardware.neuralnetworks@1.3::IBuffer 234cc547d63d2f24a447aee0a9a76cab68b31c080adadc5a960598b827a69fa2 android.hardware.neuralnetworks@1.3::IDevice 5a6b75f13f0e010a4268defa4f627b862ab2899fb04f9d985194a25bd8f9fe0d android.hardware.neuralnetworks@1.3::IDevice 058b48f0e2e725bb2b3fa2b7917b0f0a696383d03a4c57afe26f0eadb6a7af28 android.hardware.neuralnetworks@1.3::IPreparedModel 94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback 2576ba54711218ce0d7f207baa533fca9af3c630756938ede6e73fe197b7ea38 android.hardware.neuralnetworks@1.3::types 12c51f9d04a52324510419aeee3e37bb3607e6900556cdde79774d80ed989855 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 Loading neuralnetworks/1.3/IDevice.hal +8 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,14 @@ interface IDevice extends @1.2::IDevice { /** * Gets the supported operations in a model. * * getSupportedOperations indicates which operations of a model are fully * supported by the vendor driver. If an operation may not be supported for * any reason, getSupportedOperations must return false for that operation. * getSupportedOperations indicates which operations of the top-level * subgraph are fully supported by the vendor driver. If an operation may * not be supported for any reason, getSupportedOperations must return * false for that operation. * * The {@link OperationType::IF} and {@link OperationType::WHILE} * operations may only be fully supported if the vendor driver fully * supports all operations in the referenced subgraphs. * * @param model A model whose operations--and their corresponding operands-- * are to be verified by the driver. Loading neuralnetworks/1.3/types.hal +195 −56 Original line number Diff line number Diff line Loading @@ -17,9 +17,10 @@ package android.hardware.neuralnetworks@1.3; import @1.0::DataLocation; import @1.0::OperandLifeTime; import @1.0::PerformanceInfo; import @1.0::RequestArgument; import @1.2::Model.ExtensionNameAndPrefix; import @1.2::Model.ExtensionTypeEncoding; import @1.2::OperandType; import @1.2::OperationType; import @1.2::SymmPerChannelQuantParams; Loading @@ -40,6 +41,13 @@ enum OperandType : @1.2::OperandType { */ TENSOR_QUANT8_ASYMM_SIGNED = 14, /** * A reference to a subgraph. * * Must have the lifetime {@link OperandLifeTime::SUBGRAPH}. */ SUBGRAPH = 15, /* * DEPRECATED. Since HAL version 1.2, extensions are the preferred * alternative to OEM operation and data types. Loading Loading @@ -68,7 +76,7 @@ enum OperandType : @1.2::OperandType { enum OperandTypeRange : uint32_t { BASE_MIN = 0, FUNDAMENTAL_MIN = 0, FUNDAMENTAL_MAX = 14, FUNDAMENTAL_MAX = 15, OEM_MIN = 10000, OEM_MAX = 10001, BASE_MAX = 0xFFFF, Loading Loading @@ -4876,6 +4884,92 @@ enum OperationType : int32_t { */ QUANTIZED_LSTM = 95, /** * Executes one of the two referenced subgraphs as determined by a boolean * value. * * The inputs and outputs of the two referenced subgraphs must agree with the * signature of this operation. That is, if the operation has (3 + n) inputs * and m outputs, both subgraphs must have n inputs and m outputs with the same * types as the corresponding operation inputs and outputs. * * Inputs: * * 0: A value of type {@link OperandType::TENSOR_BOOL8} and shape [1] * that determines which of the two referenced subgraphs to execute. * * 1: A {@link OperandType::SUBGRAPH} reference to the subgraph to be * executed if the condition is true. * * 2: A {@link OperandType::SUBGRAPH} reference to the subgraph to be * executed if the condition is false. * * 3 ~ (n + 2): Inputs to be passed to the subgraph selected for execution. * * Outputs: * * 0 ~ (m - 1): Outputs produced by the selected subgraph. */ IF = 96, /** * Executes the body subgraph until the condition subgraph outputs false. * * The inputs to this operation are the condition subgraph, the body subgraph, * and operand values for the first iteration of the loop. The values are * implicitly split into three groups of input-output, state-only, and * input-only values, as described below. * * The outputs of this operation are the final values of input-output * operands. * * Both the condition and body subgraph receive (m + k + n) inputs. * * The first m (m >= 1) inputs are input-output operands. For the first * iteration, these are initialized from the corresponding inputs of the * WHILE operation. In subsequent iterations, their values come from the * corresponding outputs of the body subgraph produced during the previous * iteration. * * The next k (k >= 0) inputs are state-only operands. They are similar to * the input-output operands, except that their values are no longer * available after the loop terminates. * * The last n (n >= 0) inputs are input-only operands. Their values come * from the corresponding inputs of the WHILE operation. * * The body subgraph produces (m + k) outputs. * * The first m outputs are input-output operands. They become the outputs * of the WHILE operation when a termination condition is reached. * * The last k outputs are state-only operands. Their values are no longer * available after the loop terminates. * * The numbers m, k, and n are inferred by the driver as follows: * m = (WHILE operation output count) * k = (body subgraph output count) - m * n = (body subgraph input count) - m - k * * The pseudo-code below illustrates the flow of a WHILE operation with * inputs condition, body, initial_input_output, initial_state, input_only * (m = 1, k = 1, n = 1): * * input_output = initial_input_output * state = initial_state * while condition(input_output, state, input_only): * input_output, state = body(input_output, state, input_only) * return input_output * * Inputs: * * 0: A {@link OperandType::SUBGRAPH} reference to the condition * subgraph. The subgraph must have (m + k + n) inputs with * the same types as the corresponding inputs of the WHILE operation * and exactly one output of {@link OperandType::TENSOR_BOOL8} * and shape [1]. * * 1: A {@link OperandType::SUBGRAPH} reference to the body subgraph. * The subgraph must have (m + k + n) inputs and (m + k) outputs with * the same types as the corresponding inputs and outputs of the WHILE * operation. * * (m inputs): Initial values for input-output operands. * * (k inputs): Initial values for state-only operands. * * (n inputs): Values for input-only operands. * * Outputs: * * 0 ~ (m - 1): Outputs produced by the loop. */ WHILE = 97, /** * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to * OEM operation and data types. Loading @@ -4898,13 +4992,12 @@ enum OperationType : int32_t { enum OperationTypeRange : uint32_t { BASE_MIN = 0, FUNDAMENTAL_MIN = 0, FUNDAMENTAL_MAX = 95, FUNDAMENTAL_MAX = 97, OEM_MIN = 10000, OEM_MAX = 10000, BASE_MAX = 0xFFFF, }; /** * The capabilities of a driver. * Loading Loading @@ -4965,6 +5058,59 @@ struct Operation { vec<uint32_t> outputs; }; /** * How an operand is used. */ enum OperandLifeTime : int32_t { /** * The operand is internal to the model. It's created by an operation and * consumed by other operations. It must be an output operand of * exactly one operation. */ TEMPORARY_VARIABLE, /** * The operand is an input of a subgraph. It must not be an output * operand of any operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_INPUT, /** * The operand is an output of a subgraph. It must be an output * operand of exactly one operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_OUTPUT, /** * The operand is a constant found in Model.operandValues. It must * not be an output operand of any operation. */ CONSTANT_COPY, /** * The operand is a constant that was specified via a Memory * object. It must not be an output operand of any operation. */ CONSTANT_REFERENCE, /** * The operand does not have a value. This is valid only for optional * arguments of operations. */ NO_VALUE, /** * The operand is a reference to a subgraph. It must be an input to one * or more {@link OperationType::IF} or {@link OperationType::WHILE} * operations. */ SUBGRAPH, }; /** * Describes one operand of the model's graph. */ Loading Loading @@ -5001,7 +5147,7 @@ struct Operand { * . The operand has lifetime CONSTANT_COPY or * CONSTANT_REFERENCE. * * . The operand has lifetime MODEL_INPUT. Fully * . The operand has lifetime SUBGRAPH_INPUT. Fully * specified dimensions must either be present in the * Operand or they must be provided in the corresponding * RequestArgument. Loading Loading @@ -5049,8 +5195,8 @@ struct Operand { /** * Where to find the data for this operand. * If the lifetime is TEMPORARY_VARIABLE, MODEL_INPUT, MODEL_OUTPUT, or * NO_VALUE: * If the lifetime is TEMPORARY_VARIABLE, SUBGRAPH_INPUT, SUBGRAPH_OUTPUT, * or NO_VALUE: * - All the fields must be 0. * If the lifetime is CONSTANT_COPY: * - location.poolIndex is 0. Loading @@ -5060,6 +5206,11 @@ struct Operand { * - location.poolIndex is set. * - location.offset is the offset in bytes into the specified pool. * - location.length is set. * If the lifetime is SUBGRAPH: * - location.poolIndex is 0. * - location.offset is the index of the referenced subgraph in * {@link Model::referenced}. * - location.length is 0. */ DataLocation location; Loading Loading @@ -5098,32 +5249,19 @@ struct Operand { */ struct Model { /** * All operands included in the model. * The top-level subgraph. */ vec<Operand> operands; Subgraph main; /** * All operations included in the model. * Referenced subgraphs. * * The operations are sorted into execution order. Every operand * with lifetime MODEL_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ vec<Operation> operations; /** * Input indexes of the model. There must be at least one. * Each subgraph is referenced by the main subgraph or at least one other * referenced subgraph. * * Each value corresponds to the index of the operand in "operands". * There must be no reference cycles. */ vec<uint32_t> inputIndexes; /** * Output indexes of the model. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ vec<uint32_t> outputIndexes; vec<Subgraph> referenced; /** * A byte buffer containing operand data that were copied into the model. Loading Loading @@ -5157,9 +5295,9 @@ struct Model { * {@link OperandTypeRange::BASE_MAX} or * {@link OperationTypeRange::BASE_MAX} respectively should be interpreted * as an extension operand. The low * {@link Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the value * correspond to the type ID within the extension and the high * {@link Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * {@link @1.2::Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the * value correspond to the type ID within the extension and the high * {@link @1.2::Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * the "prefix", which maps uniquely to the extension name. * * For example, if a model contains an operation whose value is Loading @@ -5172,39 +5310,40 @@ struct Model { * prefix corresponding to each extension name and at most one extension * name corresponding to each prefix. */ vec<ExtensionNameAndPrefix> extensionNameToPrefix; vec<@1.2::Model.ExtensionNameAndPrefix> extensionNameToPrefix; }; /** * A correspondence between an extension name and a prefix of operand and * operation type values. * An excerpt of the execution graph. */ struct ExtensionNameAndPrefix { struct Subgraph { /** * The extension name. * All operands included in the subgraph. */ vec<Operand> operands; /** * All operations included in the subgraph. * * See {@link Extension::name} for the format specification. * The operations are sorted into execution order. Every operand * with lifetime SUBGRAPH_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ string name; vec<Operation> operations; /** * The unique extension identifier within the model. * Input indexes of the subgraph. There must be at least one. * * See {@link Model::extensionNameToPrefix}. * Each value corresponds to the index of the operand in "operands". */ uint16_t prefix; }; vec<uint32_t> inputIndexes; /** * Numeric values of extension operand and operation types have the * following structure: * - 16 high bits represent the "prefix", which corresponds uniquely to the * extension name. * - 16 low bits represent the type ID within the extension. * Output indexes of the subgraph. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ enum ExtensionTypeEncoding : uint8_t { HIGH_BITS_PREFIX = 16, LOW_BITS_TYPE = 16, }; vec<uint32_t> outputIndexes; }; /** Loading neuralnetworks/1.3/types.t +100 −54 Original line number Diff line number Diff line Loading @@ -19,9 +19,10 @@ package android.hardware.neuralnetworks@1.3; import @1.0::DataLocation; import @1.0::OperandLifeTime; import @1.0::PerformanceInfo; import @1.0::RequestArgument; import @1.2::Model.ExtensionNameAndPrefix; import @1.2::Model.ExtensionTypeEncoding; import @1.2::OperandType; import @1.2::OperationType; import @1.2::SymmPerChannelQuantParams; Loading Loading @@ -88,7 +89,6 @@ enum OperationTypeRange : uint32_t { BASE_MAX = 0xFFFF, }; /** * The capabilities of a driver. * Loading Loading @@ -149,6 +149,59 @@ struct Operation { vec<uint32_t> outputs; }; /** * How an operand is used. */ enum OperandLifeTime : int32_t { /** * The operand is internal to the model. It's created by an operation and * consumed by other operations. It must be an output operand of * exactly one operation. */ TEMPORARY_VARIABLE, /** * The operand is an input of a subgraph. It must not be an output * operand of any operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_INPUT, /** * The operand is an output of a subgraph. It must be an output * operand of exactly one operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_OUTPUT, /** * The operand is a constant found in Model.operandValues. It must * not be an output operand of any operation. */ CONSTANT_COPY, /** * The operand is a constant that was specified via a Memory * object. It must not be an output operand of any operation. */ CONSTANT_REFERENCE, /** * The operand does not have a value. This is valid only for optional * arguments of operations. */ NO_VALUE, /** * The operand is a reference to a subgraph. It must be an input to one * or more {@link OperationType::IF} or {@link OperationType::WHILE} * operations. */ SUBGRAPH, }; /** * Describes one operand of the model's graph. */ Loading Loading @@ -185,7 +238,7 @@ struct Operand { * . The operand has lifetime CONSTANT_COPY or * CONSTANT_REFERENCE. * * . The operand has lifetime MODEL_INPUT. Fully * . The operand has lifetime SUBGRAPH_INPUT. Fully * specified dimensions must either be present in the * Operand or they must be provided in the corresponding * RequestArgument. Loading Loading @@ -233,8 +286,8 @@ struct Operand { /** * Where to find the data for this operand. * If the lifetime is TEMPORARY_VARIABLE, MODEL_INPUT, MODEL_OUTPUT, or * NO_VALUE: * If the lifetime is TEMPORARY_VARIABLE, SUBGRAPH_INPUT, SUBGRAPH_OUTPUT, * or NO_VALUE: * - All the fields must be 0. * If the lifetime is CONSTANT_COPY: * - location.poolIndex is 0. Loading @@ -244,6 +297,11 @@ struct Operand { * - location.poolIndex is set. * - location.offset is the offset in bytes into the specified pool. * - location.length is set. * If the lifetime is SUBGRAPH: * - location.poolIndex is 0. * - location.offset is the index of the referenced subgraph in * {@link Model::referenced}. * - location.length is 0. */ DataLocation location; Loading Loading @@ -282,32 +340,19 @@ struct Operand { */ struct Model { /** * All operands included in the model. * The top-level subgraph. */ vec<Operand> operands; Subgraph main; /** * All operations included in the model. * Referenced subgraphs. * * The operations are sorted into execution order. Every operand * with lifetime MODEL_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ vec<Operation> operations; /** * Input indexes of the model. There must be at least one. * Each subgraph is referenced by the main subgraph or at least one other * referenced subgraph. * * Each value corresponds to the index of the operand in "operands". * There must be no reference cycles. */ vec<uint32_t> inputIndexes; /** * Output indexes of the model. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ vec<uint32_t> outputIndexes; vec<Subgraph> referenced; /** * A byte buffer containing operand data that were copied into the model. Loading Loading @@ -341,9 +386,9 @@ struct Model { * {@link OperandTypeRange::BASE_MAX} or * {@link OperationTypeRange::BASE_MAX} respectively should be interpreted * as an extension operand. The low * {@link Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the value * correspond to the type ID within the extension and the high * {@link Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * {@link @1.2::Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the * value correspond to the type ID within the extension and the high * {@link @1.2::Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * the "prefix", which maps uniquely to the extension name. * * For example, if a model contains an operation whose value is Loading @@ -356,39 +401,40 @@ struct Model { * prefix corresponding to each extension name and at most one extension * name corresponding to each prefix. */ vec<ExtensionNameAndPrefix> extensionNameToPrefix; vec<@1.2::Model.ExtensionNameAndPrefix> extensionNameToPrefix; }; /** * A correspondence between an extension name and a prefix of operand and * operation type values. * An excerpt of the execution graph. */ struct ExtensionNameAndPrefix { struct Subgraph { /** * The extension name. * All operands included in the subgraph. */ vec<Operand> operands; /** * All operations included in the subgraph. * * See {@link Extension::name} for the format specification. * The operations are sorted into execution order. Every operand * with lifetime SUBGRAPH_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ string name; vec<Operation> operations; /** * The unique extension identifier within the model. * Input indexes of the subgraph. There must be at least one. * * See {@link Model::extensionNameToPrefix}. * Each value corresponds to the index of the operand in "operands". */ uint16_t prefix; }; vec<uint32_t> inputIndexes; /** * Numeric values of extension operand and operation types have the * following structure: * - 16 high bits represent the "prefix", which corresponds uniquely to the * extension name. * - 16 low bits represent the type ID within the extension. * Output indexes of the subgraph. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ enum ExtensionTypeEncoding : uint8_t { HIGH_BITS_PREFIX = 16, LOW_BITS_TYPE = 16, }; vec<uint32_t> outputIndexes; }; /** Loading neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ class CompilationCachingTestBase : public testing::Test { model, [&fullySupportsModel, &model](ErrorStatus status, const hidl_vec<bool>& supported) { ASSERT_EQ(ErrorStatus::NONE, status); ASSERT_EQ(supported.size(), model.operations.size()); ASSERT_EQ(supported.size(), model.main.operations.size()); fullySupportsModel = std::all_of(supported.begin(), supported.end(), [](bool valid) { return valid; }); }); Loading Loading
current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -623,10 +623,10 @@ bbeee9604128ede83ee755b67e73b5ad29e6e1dbac9ec41fea6ffe2745b0c50a android.hardwar adb0efdf1462e9b2e742c0dcadd598666aac551f178be06e755bfcdf5797abd0 android.hardware.keymaster@4.1::IOperation ac429fca0da4ce91218768ec31b64ded88251f8a26d8c4f27c06abdc5b1926d9 android.hardware.keymaster@4.1::types 4b5c8546533db9412fec6d32c0ef42b22e5e68dbf390c775ec3c22bb2d501102 android.hardware.neuralnetworks@1.3::IBuffer 234cc547d63d2f24a447aee0a9a76cab68b31c080adadc5a960598b827a69fa2 android.hardware.neuralnetworks@1.3::IDevice 5a6b75f13f0e010a4268defa4f627b862ab2899fb04f9d985194a25bd8f9fe0d android.hardware.neuralnetworks@1.3::IDevice 058b48f0e2e725bb2b3fa2b7917b0f0a696383d03a4c57afe26f0eadb6a7af28 android.hardware.neuralnetworks@1.3::IPreparedModel 94e803236398bed1febb11cc21051bc42ec003700139b099d6c479e02a7ca3c3 android.hardware.neuralnetworks@1.3::IPreparedModelCallback 2576ba54711218ce0d7f207baa533fca9af3c630756938ede6e73fe197b7ea38 android.hardware.neuralnetworks@1.3::types 12c51f9d04a52324510419aeee3e37bb3607e6900556cdde79774d80ed989855 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 Loading
neuralnetworks/1.3/IDevice.hal +8 −3 Original line number Diff line number Diff line Loading @@ -48,9 +48,14 @@ interface IDevice extends @1.2::IDevice { /** * Gets the supported operations in a model. * * getSupportedOperations indicates which operations of a model are fully * supported by the vendor driver. If an operation may not be supported for * any reason, getSupportedOperations must return false for that operation. * getSupportedOperations indicates which operations of the top-level * subgraph are fully supported by the vendor driver. If an operation may * not be supported for any reason, getSupportedOperations must return * false for that operation. * * The {@link OperationType::IF} and {@link OperationType::WHILE} * operations may only be fully supported if the vendor driver fully * supports all operations in the referenced subgraphs. * * @param model A model whose operations--and their corresponding operands-- * are to be verified by the driver. Loading
neuralnetworks/1.3/types.hal +195 −56 Original line number Diff line number Diff line Loading @@ -17,9 +17,10 @@ package android.hardware.neuralnetworks@1.3; import @1.0::DataLocation; import @1.0::OperandLifeTime; import @1.0::PerformanceInfo; import @1.0::RequestArgument; import @1.2::Model.ExtensionNameAndPrefix; import @1.2::Model.ExtensionTypeEncoding; import @1.2::OperandType; import @1.2::OperationType; import @1.2::SymmPerChannelQuantParams; Loading @@ -40,6 +41,13 @@ enum OperandType : @1.2::OperandType { */ TENSOR_QUANT8_ASYMM_SIGNED = 14, /** * A reference to a subgraph. * * Must have the lifetime {@link OperandLifeTime::SUBGRAPH}. */ SUBGRAPH = 15, /* * DEPRECATED. Since HAL version 1.2, extensions are the preferred * alternative to OEM operation and data types. Loading Loading @@ -68,7 +76,7 @@ enum OperandType : @1.2::OperandType { enum OperandTypeRange : uint32_t { BASE_MIN = 0, FUNDAMENTAL_MIN = 0, FUNDAMENTAL_MAX = 14, FUNDAMENTAL_MAX = 15, OEM_MIN = 10000, OEM_MAX = 10001, BASE_MAX = 0xFFFF, Loading Loading @@ -4876,6 +4884,92 @@ enum OperationType : int32_t { */ QUANTIZED_LSTM = 95, /** * Executes one of the two referenced subgraphs as determined by a boolean * value. * * The inputs and outputs of the two referenced subgraphs must agree with the * signature of this operation. That is, if the operation has (3 + n) inputs * and m outputs, both subgraphs must have n inputs and m outputs with the same * types as the corresponding operation inputs and outputs. * * Inputs: * * 0: A value of type {@link OperandType::TENSOR_BOOL8} and shape [1] * that determines which of the two referenced subgraphs to execute. * * 1: A {@link OperandType::SUBGRAPH} reference to the subgraph to be * executed if the condition is true. * * 2: A {@link OperandType::SUBGRAPH} reference to the subgraph to be * executed if the condition is false. * * 3 ~ (n + 2): Inputs to be passed to the subgraph selected for execution. * * Outputs: * * 0 ~ (m - 1): Outputs produced by the selected subgraph. */ IF = 96, /** * Executes the body subgraph until the condition subgraph outputs false. * * The inputs to this operation are the condition subgraph, the body subgraph, * and operand values for the first iteration of the loop. The values are * implicitly split into three groups of input-output, state-only, and * input-only values, as described below. * * The outputs of this operation are the final values of input-output * operands. * * Both the condition and body subgraph receive (m + k + n) inputs. * * The first m (m >= 1) inputs are input-output operands. For the first * iteration, these are initialized from the corresponding inputs of the * WHILE operation. In subsequent iterations, their values come from the * corresponding outputs of the body subgraph produced during the previous * iteration. * * The next k (k >= 0) inputs are state-only operands. They are similar to * the input-output operands, except that their values are no longer * available after the loop terminates. * * The last n (n >= 0) inputs are input-only operands. Their values come * from the corresponding inputs of the WHILE operation. * * The body subgraph produces (m + k) outputs. * * The first m outputs are input-output operands. They become the outputs * of the WHILE operation when a termination condition is reached. * * The last k outputs are state-only operands. Their values are no longer * available after the loop terminates. * * The numbers m, k, and n are inferred by the driver as follows: * m = (WHILE operation output count) * k = (body subgraph output count) - m * n = (body subgraph input count) - m - k * * The pseudo-code below illustrates the flow of a WHILE operation with * inputs condition, body, initial_input_output, initial_state, input_only * (m = 1, k = 1, n = 1): * * input_output = initial_input_output * state = initial_state * while condition(input_output, state, input_only): * input_output, state = body(input_output, state, input_only) * return input_output * * Inputs: * * 0: A {@link OperandType::SUBGRAPH} reference to the condition * subgraph. The subgraph must have (m + k + n) inputs with * the same types as the corresponding inputs of the WHILE operation * and exactly one output of {@link OperandType::TENSOR_BOOL8} * and shape [1]. * * 1: A {@link OperandType::SUBGRAPH} reference to the body subgraph. * The subgraph must have (m + k + n) inputs and (m + k) outputs with * the same types as the corresponding inputs and outputs of the WHILE * operation. * * (m inputs): Initial values for input-output operands. * * (k inputs): Initial values for state-only operands. * * (n inputs): Values for input-only operands. * * Outputs: * * 0 ~ (m - 1): Outputs produced by the loop. */ WHILE = 97, /** * DEPRECATED. Since NNAPI 1.2, extensions are the preferred alternative to * OEM operation and data types. Loading @@ -4898,13 +4992,12 @@ enum OperationType : int32_t { enum OperationTypeRange : uint32_t { BASE_MIN = 0, FUNDAMENTAL_MIN = 0, FUNDAMENTAL_MAX = 95, FUNDAMENTAL_MAX = 97, OEM_MIN = 10000, OEM_MAX = 10000, BASE_MAX = 0xFFFF, }; /** * The capabilities of a driver. * Loading Loading @@ -4965,6 +5058,59 @@ struct Operation { vec<uint32_t> outputs; }; /** * How an operand is used. */ enum OperandLifeTime : int32_t { /** * The operand is internal to the model. It's created by an operation and * consumed by other operations. It must be an output operand of * exactly one operation. */ TEMPORARY_VARIABLE, /** * The operand is an input of a subgraph. It must not be an output * operand of any operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_INPUT, /** * The operand is an output of a subgraph. It must be an output * operand of exactly one operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_OUTPUT, /** * The operand is a constant found in Model.operandValues. It must * not be an output operand of any operation. */ CONSTANT_COPY, /** * The operand is a constant that was specified via a Memory * object. It must not be an output operand of any operation. */ CONSTANT_REFERENCE, /** * The operand does not have a value. This is valid only for optional * arguments of operations. */ NO_VALUE, /** * The operand is a reference to a subgraph. It must be an input to one * or more {@link OperationType::IF} or {@link OperationType::WHILE} * operations. */ SUBGRAPH, }; /** * Describes one operand of the model's graph. */ Loading Loading @@ -5001,7 +5147,7 @@ struct Operand { * . The operand has lifetime CONSTANT_COPY or * CONSTANT_REFERENCE. * * . The operand has lifetime MODEL_INPUT. Fully * . The operand has lifetime SUBGRAPH_INPUT. Fully * specified dimensions must either be present in the * Operand or they must be provided in the corresponding * RequestArgument. Loading Loading @@ -5049,8 +5195,8 @@ struct Operand { /** * Where to find the data for this operand. * If the lifetime is TEMPORARY_VARIABLE, MODEL_INPUT, MODEL_OUTPUT, or * NO_VALUE: * If the lifetime is TEMPORARY_VARIABLE, SUBGRAPH_INPUT, SUBGRAPH_OUTPUT, * or NO_VALUE: * - All the fields must be 0. * If the lifetime is CONSTANT_COPY: * - location.poolIndex is 0. Loading @@ -5060,6 +5206,11 @@ struct Operand { * - location.poolIndex is set. * - location.offset is the offset in bytes into the specified pool. * - location.length is set. * If the lifetime is SUBGRAPH: * - location.poolIndex is 0. * - location.offset is the index of the referenced subgraph in * {@link Model::referenced}. * - location.length is 0. */ DataLocation location; Loading Loading @@ -5098,32 +5249,19 @@ struct Operand { */ struct Model { /** * All operands included in the model. * The top-level subgraph. */ vec<Operand> operands; Subgraph main; /** * All operations included in the model. * Referenced subgraphs. * * The operations are sorted into execution order. Every operand * with lifetime MODEL_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ vec<Operation> operations; /** * Input indexes of the model. There must be at least one. * Each subgraph is referenced by the main subgraph or at least one other * referenced subgraph. * * Each value corresponds to the index of the operand in "operands". * There must be no reference cycles. */ vec<uint32_t> inputIndexes; /** * Output indexes of the model. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ vec<uint32_t> outputIndexes; vec<Subgraph> referenced; /** * A byte buffer containing operand data that were copied into the model. Loading Loading @@ -5157,9 +5295,9 @@ struct Model { * {@link OperandTypeRange::BASE_MAX} or * {@link OperationTypeRange::BASE_MAX} respectively should be interpreted * as an extension operand. The low * {@link Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the value * correspond to the type ID within the extension and the high * {@link Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * {@link @1.2::Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the * value correspond to the type ID within the extension and the high * {@link @1.2::Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * the "prefix", which maps uniquely to the extension name. * * For example, if a model contains an operation whose value is Loading @@ -5172,39 +5310,40 @@ struct Model { * prefix corresponding to each extension name and at most one extension * name corresponding to each prefix. */ vec<ExtensionNameAndPrefix> extensionNameToPrefix; vec<@1.2::Model.ExtensionNameAndPrefix> extensionNameToPrefix; }; /** * A correspondence between an extension name and a prefix of operand and * operation type values. * An excerpt of the execution graph. */ struct ExtensionNameAndPrefix { struct Subgraph { /** * The extension name. * All operands included in the subgraph. */ vec<Operand> operands; /** * All operations included in the subgraph. * * See {@link Extension::name} for the format specification. * The operations are sorted into execution order. Every operand * with lifetime SUBGRAPH_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ string name; vec<Operation> operations; /** * The unique extension identifier within the model. * Input indexes of the subgraph. There must be at least one. * * See {@link Model::extensionNameToPrefix}. * Each value corresponds to the index of the operand in "operands". */ uint16_t prefix; }; vec<uint32_t> inputIndexes; /** * Numeric values of extension operand and operation types have the * following structure: * - 16 high bits represent the "prefix", which corresponds uniquely to the * extension name. * - 16 low bits represent the type ID within the extension. * Output indexes of the subgraph. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ enum ExtensionTypeEncoding : uint8_t { HIGH_BITS_PREFIX = 16, LOW_BITS_TYPE = 16, }; vec<uint32_t> outputIndexes; }; /** Loading
neuralnetworks/1.3/types.t +100 −54 Original line number Diff line number Diff line Loading @@ -19,9 +19,10 @@ package android.hardware.neuralnetworks@1.3; import @1.0::DataLocation; import @1.0::OperandLifeTime; import @1.0::PerformanceInfo; import @1.0::RequestArgument; import @1.2::Model.ExtensionNameAndPrefix; import @1.2::Model.ExtensionTypeEncoding; import @1.2::OperandType; import @1.2::OperationType; import @1.2::SymmPerChannelQuantParams; Loading Loading @@ -88,7 +89,6 @@ enum OperationTypeRange : uint32_t { BASE_MAX = 0xFFFF, }; /** * The capabilities of a driver. * Loading Loading @@ -149,6 +149,59 @@ struct Operation { vec<uint32_t> outputs; }; /** * How an operand is used. */ enum OperandLifeTime : int32_t { /** * The operand is internal to the model. It's created by an operation and * consumed by other operations. It must be an output operand of * exactly one operation. */ TEMPORARY_VARIABLE, /** * The operand is an input of a subgraph. It must not be an output * operand of any operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_INPUT, /** * The operand is an output of a subgraph. It must be an output * operand of exactly one operation. * * An operand can't be both input and output of a subgraph. */ SUBGRAPH_OUTPUT, /** * The operand is a constant found in Model.operandValues. It must * not be an output operand of any operation. */ CONSTANT_COPY, /** * The operand is a constant that was specified via a Memory * object. It must not be an output operand of any operation. */ CONSTANT_REFERENCE, /** * The operand does not have a value. This is valid only for optional * arguments of operations. */ NO_VALUE, /** * The operand is a reference to a subgraph. It must be an input to one * or more {@link OperationType::IF} or {@link OperationType::WHILE} * operations. */ SUBGRAPH, }; /** * Describes one operand of the model's graph. */ Loading Loading @@ -185,7 +238,7 @@ struct Operand { * . The operand has lifetime CONSTANT_COPY or * CONSTANT_REFERENCE. * * . The operand has lifetime MODEL_INPUT. Fully * . The operand has lifetime SUBGRAPH_INPUT. Fully * specified dimensions must either be present in the * Operand or they must be provided in the corresponding * RequestArgument. Loading Loading @@ -233,8 +286,8 @@ struct Operand { /** * Where to find the data for this operand. * If the lifetime is TEMPORARY_VARIABLE, MODEL_INPUT, MODEL_OUTPUT, or * NO_VALUE: * If the lifetime is TEMPORARY_VARIABLE, SUBGRAPH_INPUT, SUBGRAPH_OUTPUT, * or NO_VALUE: * - All the fields must be 0. * If the lifetime is CONSTANT_COPY: * - location.poolIndex is 0. Loading @@ -244,6 +297,11 @@ struct Operand { * - location.poolIndex is set. * - location.offset is the offset in bytes into the specified pool. * - location.length is set. * If the lifetime is SUBGRAPH: * - location.poolIndex is 0. * - location.offset is the index of the referenced subgraph in * {@link Model::referenced}. * - location.length is 0. */ DataLocation location; Loading Loading @@ -282,32 +340,19 @@ struct Operand { */ struct Model { /** * All operands included in the model. * The top-level subgraph. */ vec<Operand> operands; Subgraph main; /** * All operations included in the model. * Referenced subgraphs. * * The operations are sorted into execution order. Every operand * with lifetime MODEL_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ vec<Operation> operations; /** * Input indexes of the model. There must be at least one. * Each subgraph is referenced by the main subgraph or at least one other * referenced subgraph. * * Each value corresponds to the index of the operand in "operands". * There must be no reference cycles. */ vec<uint32_t> inputIndexes; /** * Output indexes of the model. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ vec<uint32_t> outputIndexes; vec<Subgraph> referenced; /** * A byte buffer containing operand data that were copied into the model. Loading Loading @@ -341,9 +386,9 @@ struct Model { * {@link OperandTypeRange::BASE_MAX} or * {@link OperationTypeRange::BASE_MAX} respectively should be interpreted * as an extension operand. The low * {@link Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the value * correspond to the type ID within the extension and the high * {@link Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * {@link @1.2::Model::ExtensionTypeEncoding::LOW_BITS_TYPE} bits of the * value correspond to the type ID within the extension and the high * {@link @1.2::Model::ExtensionTypeEncoding::HIGH_BITS_PREFIX} bits encode * the "prefix", which maps uniquely to the extension name. * * For example, if a model contains an operation whose value is Loading @@ -356,39 +401,40 @@ struct Model { * prefix corresponding to each extension name and at most one extension * name corresponding to each prefix. */ vec<ExtensionNameAndPrefix> extensionNameToPrefix; vec<@1.2::Model.ExtensionNameAndPrefix> extensionNameToPrefix; }; /** * A correspondence between an extension name and a prefix of operand and * operation type values. * An excerpt of the execution graph. */ struct ExtensionNameAndPrefix { struct Subgraph { /** * The extension name. * All operands included in the subgraph. */ vec<Operand> operands; /** * All operations included in the subgraph. * * See {@link Extension::name} for the format specification. * The operations are sorted into execution order. Every operand * with lifetime SUBGRAPH_OUTPUT or TEMPORARY_VARIABLE must be * written before it is read. */ string name; vec<Operation> operations; /** * The unique extension identifier within the model. * Input indexes of the subgraph. There must be at least one. * * See {@link Model::extensionNameToPrefix}. * Each value corresponds to the index of the operand in "operands". */ uint16_t prefix; }; vec<uint32_t> inputIndexes; /** * Numeric values of extension operand and operation types have the * following structure: * - 16 high bits represent the "prefix", which corresponds uniquely to the * extension name. * - 16 low bits represent the type ID within the extension. * Output indexes of the subgraph. There must be at least one. * * Each value corresponds to the index of the operand in "operands". */ enum ExtensionTypeEncoding : uint8_t { HIGH_BITS_PREFIX = 16, LOW_BITS_TYPE = 16, }; vec<uint32_t> outputIndexes; }; /** Loading
neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -308,7 +308,7 @@ class CompilationCachingTestBase : public testing::Test { model, [&fullySupportsModel, &model](ErrorStatus status, const hidl_vec<bool>& supported) { ASSERT_EQ(ErrorStatus::NONE, status); ASSERT_EQ(supported.size(), model.operations.size()); ASSERT_EQ(supported.size(), model.main.operations.size()); fullySupportsModel = std::all_of(supported.begin(), supported.end(), [](bool valid) { return valid; }); }); Loading