79 lines
3.0 KiB
C++
79 lines
3.0 KiB
C++
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
==============================================================================*/
|
|
#ifndef TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|
|
#define TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|
|
|
|
namespace tflite {
|
|
namespace ops {
|
|
namespace builtin {
|
|
namespace lstm {
|
|
// For full inputs kernel (24-inputs).
|
|
// Please note the 20-input full kernel is deprecated and only kept
|
|
// here for backward compatibility.
|
|
namespace full {
|
|
|
|
// Input Tensors of size {n_batch, n_input}
|
|
constexpr int kInputTensor = 0;
|
|
|
|
// Input weight tensors of size: {n_cell, n_input}
|
|
constexpr int kInputToInputWeightsTensor = 1; // Optional
|
|
constexpr int kInputToForgetWeightsTensor = 2;
|
|
constexpr int kInputToCellWeightsTensor = 3;
|
|
constexpr int kInputToOutputWeightsTensor = 4;
|
|
|
|
// Recurrent weight tensors of size {n_cell, n_output}
|
|
constexpr int kRecurrentToInputWeightsTensor = 5; // Optional
|
|
constexpr int kRecurrentToForgetWeightsTensor = 6;
|
|
constexpr int kRecurrentToCellWeightsTensor = 7;
|
|
constexpr int kRecurrentToOutputWeightsTensor = 8;
|
|
|
|
// Peephole weights tensors of size {n_cell}, representing a diagonal matrix.
|
|
constexpr int kCellToInputWeightsTensor = 9; // Optional
|
|
constexpr int kCellToForgetWeightsTensor = 10; // Optional
|
|
constexpr int kCellToOutputWeightsTensor = 11; // Optional
|
|
|
|
// Gates bias tensors of size {n_cell}
|
|
constexpr int kInputGateBiasTensor = 12; // Optional
|
|
constexpr int kForgetGateBiasTensor = 13;
|
|
constexpr int kCellGateBiasTensor = 14;
|
|
constexpr int kOutputGateBiasTensor = 15;
|
|
|
|
// Projection weight tensor of size {n_output, n_cell}
|
|
constexpr int kProjectionWeightsTensor = 16; // Optional
|
|
// Projection bias tensor of size {n_output}
|
|
constexpr int kProjectionBiasTensor = 17; // Optional
|
|
|
|
// These state tensors are defined as variable tensors, and will be modified by
|
|
// this op.
|
|
constexpr int kOutputStateTensor = 18;
|
|
constexpr int kCellStateTensor = 19;
|
|
|
|
// Layer norm coefficient tensors of size {n_cell}, representing a diagonal
|
|
// matrix.
|
|
constexpr int kInputLayerNormCoefficientsTensor = 20; // Optional
|
|
constexpr int kForgetLayerNormCoefficientsTensor = 21; // Optional
|
|
constexpr int kCellLayerNormCoefficientsTensor = 22; // Optional
|
|
constexpr int kOutputLayerNormCoefficientsTensor = 23; // Optional
|
|
|
|
// Output tensors.
|
|
constexpr int kOutputTensor = 0;
|
|
} // namespace full
|
|
|
|
} // namespace lstm
|
|
} // namespace builtin
|
|
} // namespace ops
|
|
} // namespace tflite
|
|
#endif // TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_
|