1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_BIDIRECTIONAL_SEQUENCE_RNN_H 18 #define ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_BIDIRECTIONAL_SEQUENCE_RNN_H 19 20 #include "OperationsValidationUtils.h" 21 22 namespace android::nn::bidirectional_sequence_rnn { 23 24 constexpr uint32_t kNumInputs = 15; 25 constexpr uint32_t kInputTensor = 0; 26 // Forward cell tensors 27 constexpr uint32_t kFwWeightsTensor = 1; 28 constexpr uint32_t kFwRecurrentWeightsTensor = 2; 29 constexpr uint32_t kFwBiasTensor = 3; 30 constexpr uint32_t kFwHiddenStateTensor = 4; 31 // Backward cell tensors 32 constexpr uint32_t kBwWeightsTensor = 5; 33 constexpr uint32_t kBwRecurrentWeightsTensor = 6; 34 constexpr uint32_t kBwBiasTensor = 7; 35 constexpr uint32_t kBwHiddenStateTensor = 8; 36 // Auxiliary inputs 37 constexpr uint32_t kAuxInputTensor = 9; // optional 38 constexpr uint32_t kFwAuxWeightsTensor = 10; // optional 39 constexpr uint32_t kBwAuxWeightsTensor = 11; // optional 40 // Cell parameters 41 constexpr uint32_t kActivationParam = 12; 42 constexpr uint32_t kTimeMajorParam = 13; 43 constexpr uint32_t kMergeOutputsParam = 14; 44 45 constexpr uint32_t kNumOutputs = 2; 46 constexpr uint32_t kNumOutputsMerged = 1; 47 constexpr uint32_t kNumOutputsWithState = 4; 48 constexpr uint32_t kNumOutputsMergedWithState = 3; 49 50 constexpr uint32_t kFwOutputTensor = 0; 51 constexpr uint32_t kBwOutputTensor = 1; // Only if mergeOutputs parameter is false 52 constexpr uint32_t kFwOutputHiddenStateTensor = 2; 53 constexpr uint32_t kBwOutputHiddenStateTensor = 3; 54 55 } // namespace android::nn::bidirectional_sequence_rnn 56 57 #endif // ANDROID_PACKAGES_MODULES_NEURALNETWORKS_COMMON_TYPES_OPERATIONS_BIDIRECTIONAL_SEQUENCE_RNN_H 58