Merge "NNAPI: Add state outputs for {UNI|BI}DIRECTIONAL_SEQUENCE_{RNN|LSTM}" am: e60fc46c56
Change-Id: I735d847175fd8f530d8aa2bfb8f07ae276fbea26
This commit is contained in:
commit
de92e47213
3 changed files with 59 additions and 4 deletions
|
@ -636,7 +636,7 @@ ddcf89cd8ee2df0d32aee55050826446fb64f7aafde0a7cd946c64f61b1a364c android.hardwar
|
|||
2fa3679ad7c94b5e88724adcd560c561041068a4ca565c63830e68101988746a android.hardware.neuralnetworks@1.3::IFencedExecutionCallback
|
||||
237b23b126a66f3432658020fed78cdd06ba6297459436fe6bae0ba753370833 android.hardware.neuralnetworks@1.3::IPreparedModel
|
||||
0439a1fbbec7f16e5e4c653d85ac685d51bfafbae15b8f8cca530acdd7d6a8ce android.hardware.neuralnetworks@1.3::IPreparedModelCallback
|
||||
abbc4e1a969881c9f8ab587add5b5e75b08df834c9c969c013ae38cb4bb16f6a android.hardware.neuralnetworks@1.3::types
|
||||
2fabd246f985d94a0172dacefb0d6cf19e2aeb2d5f17752653988ef39570a52d 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
|
||||
|
|
|
@ -2556,6 +2556,30 @@ enum OperationType : int32_t {
|
|||
* A 3-D tensor of shape:
|
||||
* If time-major: [max_time, batch_size, bw_output_size]
|
||||
* If batch-major: [batch_size, max_time, bw_output_size]
|
||||
* * 2: The forward activation state output.
|
||||
* A 2-D tensor of shape [batch_size, fw_output_size] containing an
|
||||
* activation state from the last time step in the sequence. This
|
||||
* output is optional and can be omitted. If this output is present
|
||||
* then outputs 3-5 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
* * 3: The forward cell state output.
|
||||
* A tensor of shape [batch_size, fw_cell_size] containing a cell state
|
||||
* from the last time step in the sequence. This output is optional
|
||||
* and can be omitted. If this output is present
|
||||
* then outputs 2, 4, 5 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
* * 4: The backward activation state output.
|
||||
* A 2-D tensor of shape [batch_size, bw_output_size] containing an
|
||||
* activation state from the last time step in the sequence. This
|
||||
* output is optional and can be omitted. If this output is present
|
||||
* then outputs 2, 3, 5 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
* * 5: The backward cell state output.
|
||||
* A tensor of shape [batch_size, bw_cell_size] containing a cell state
|
||||
* from the last time step in the sequence. This output is optional
|
||||
* and can be omitted. If this output is present
|
||||
* then outputs 2-4 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
*/
|
||||
BIDIRECTIONAL_SEQUENCE_LSTM = @1.2::OperationType:BIDIRECTIONAL_SEQUENCE_LSTM,
|
||||
|
||||
|
@ -2673,6 +2697,18 @@ enum OperationType : int32_t {
|
|||
* (timeMajor). If it is set to true, then the shape is set to
|
||||
* [maxTime, batchSize, bwNumUnits], otherwise the shape is set to
|
||||
* [batchSize, maxTime, bwNumUnits].
|
||||
* * 2: The forward hidden state output.
|
||||
* A 2-D tensor of shape [batchSize, fwNumUnits] containing a hidden
|
||||
* state from the last time step in the sequence. This output is
|
||||
* optional and can be omitted. If this output is present then output
|
||||
* 3 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
* * 3: The backward hidden state output.
|
||||
* A 2-D tensor of shape [batchSize, bwNumUnits] containing a hidden
|
||||
* state from the last time step in the sequence. This output is
|
||||
* optional and can be omitted. If this output is present then output
|
||||
* 2 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
*/
|
||||
BIDIRECTIONAL_SEQUENCE_RNN = @1.2::OperationType:BIDIRECTIONAL_SEQUENCE_RNN,
|
||||
|
||||
|
@ -4656,6 +4692,15 @@ enum OperationType : int32_t {
|
|||
* A 3-D tensor of shape:
|
||||
* If time-major: [max_time, batch_size, output_size]
|
||||
* If batch-major: [batch_size, max_time, output_size]
|
||||
* * 1: A tensor of shape [batch_size, output_size] containing a hidden
|
||||
* state from the last time step in the sequence. This output is
|
||||
* optional and can be omitted. If this output is present then
|
||||
* output #2 must be present as well.
|
||||
* Available since HAL version 1.3.
|
||||
* * 2: A tensor of shape [batch_size, cell_size] containing a cell state
|
||||
* from the last time step in the sequence. This output is optional
|
||||
* and can be omitted.
|
||||
* Available since HAL version 1.3.
|
||||
*/
|
||||
UNIDIRECTIONAL_SEQUENCE_LSTM = @1.2::OperationType:UNIDIRECTIONAL_SEQUENCE_LSTM,
|
||||
|
||||
|
@ -4711,6 +4756,10 @@ enum OperationType : int32_t {
|
|||
* it is set to 1, then the output has a shape [maxTime, batchSize,
|
||||
* numUnits], otherwise the output has a shape [batchSize, maxTime,
|
||||
* numUnits].
|
||||
* * 1: A tensor of shape [batchSize, numUnits] containing hidden state
|
||||
* from the last time step in the sequence. This output is optional
|
||||
* and can be omitted.
|
||||
* Available since HAL version 1.3.
|
||||
*/
|
||||
UNIDIRECTIONAL_SEQUENCE_RNN = @1.2::OperationType:UNIDIRECTIONAL_SEQUENCE_RNN,
|
||||
|
||||
|
|
|
@ -527,9 +527,15 @@ static bool removeOperandSkip(size_t operand, const Model& model) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// BIDIRECTIONAL_SEQUENCE_LSTM and BIDIRECTIONAL_SEQUENCE_RNN can have either one or two
|
||||
// outputs depending on their mergeOutputs parameter.
|
||||
if (operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
|
||||
// BIDIRECTIONAL_SEQUENCE_LSTM and BIDIRECTIONAL_SEQUENCE_RNN can have
|
||||
// either one, two, three or four outputs depending on their
|
||||
// mergeOutputs parameter and if state outputs are provided.
|
||||
// UNIDIRECTIONAL_SEQUENCE_LSTM and UNIDIRECTIONAL_SEQUENCE_RNN can have
|
||||
// either one or three outputs depending on whether state outputs are
|
||||
// provided.
|
||||
if (operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_LSTM ||
|
||||
operation.type == OperationType::UNIDIRECTIONAL_SEQUENCE_RNN ||
|
||||
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_LSTM ||
|
||||
operation.type == OperationType::BIDIRECTIONAL_SEQUENCE_RNN) {
|
||||
for (const size_t outOprand : operation.outputs) {
|
||||
if (operand == outOprand) {
|
||||
|
|
Loading…
Reference in a new issue