aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/kernels/lstm.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-05-16 20:31:29 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-16 20:34:29 -0700
commitb2e53b91019f9ab00fe133fe10b2d29bc7e5886c (patch)
tree4c22811166bf58ac47668d18d0b5ff6685b53a56 /tensorflow/contrib/lite/kernels/lstm.cc
parent0668573009abcf80b84ae7096211e83ae6ca6477 (diff)
Making GetOptionalInput from kernel_util.h return a pointer to const data.
PiperOrigin-RevId: 196932028
Diffstat (limited to 'tensorflow/contrib/lite/kernels/lstm.cc')
-rw-r--r--tensorflow/contrib/lite/kernels/lstm.cc34
1 files changed, 17 insertions, 17 deletions
diff --git a/tensorflow/contrib/lite/kernels/lstm.cc b/tensorflow/contrib/lite/kernels/lstm.cc
index 8d447a2dcf..990b3da055 100644
--- a/tensorflow/contrib/lite/kernels/lstm.cc
+++ b/tensorflow/contrib/lite/kernels/lstm.cc
@@ -92,7 +92,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TF_LITE_ENSURE(context, params->cell_clip >= 0);
TF_LITE_ENSURE(context, params->proj_clip >= 0);
- TfLiteTensor* input_to_input_weights =
+ const TfLiteTensor* input_to_input_weights =
GetOptionalInputTensor(context, node, kInputToInputWeightsTensor);
if (input_to_input_weights) {
TF_LITE_ENSURE_EQ(context, input_to_input_weights->dims->size, 2);
@@ -112,7 +112,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TF_LITE_ENSURE_EQ(context, input_to_cell_weights->dims->data[0], n_cell);
TF_LITE_ENSURE_EQ(context, input_to_cell_weights->dims->data[1], n_input);
- TfLiteTensor* recurrent_to_input_weights =
+ const TfLiteTensor* recurrent_to_input_weights =
GetOptionalInputTensor(context, node, kRecurrentToInputWeightsTensor);
if (recurrent_to_input_weights) {
TF_LITE_ENSURE_EQ(context, recurrent_to_input_weights->dims->size, 2);
@@ -146,21 +146,21 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
(recurrent_to_input_weights == nullptr));
TF_LITE_ENSURE(context, cifg_weights_all_or_none == true);
- TfLiteTensor* cell_to_input_weights =
+ const TfLiteTensor* cell_to_input_weights =
GetOptionalInputTensor(context, node, kCellToInputWeightsTensor);
if (cell_to_input_weights) {
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_input_weights->dims->data[0], n_cell);
}
- TfLiteTensor* cell_to_forget_weights =
+ const TfLiteTensor* cell_to_forget_weights =
GetOptionalInputTensor(context, node, kCellToForgetWeightsTensor);
if (cell_to_forget_weights) {
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->size, 1);
TF_LITE_ENSURE_EQ(context, cell_to_forget_weights->dims->data[0], n_cell);
}
- TfLiteTensor* cell_to_output_weights =
+ const TfLiteTensor* cell_to_output_weights =
GetOptionalInputTensor(context, node, kCellToOutputWeightsTensor);
if (cell_to_output_weights) {
TF_LITE_ENSURE_EQ(context, cell_to_output_weights->dims->size, 1);
@@ -179,7 +179,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TF_LITE_ENSURE(context, peephole_weights_all_or_none == true);
// Make sure the input gate bias is present only when not a CIFG-LSTM.
- TfLiteTensor* input_gate_bias =
+ const TfLiteTensor* input_gate_bias =
GetOptionalInputTensor(context, node, kInputGateBiasTensor);
if (use_cifg) {
TF_LITE_ENSURE_EQ(context, input_gate_bias, nullptr);
@@ -202,7 +202,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TF_LITE_ENSURE_EQ(context, output_gate_bias->dims->size, 1);
TF_LITE_ENSURE_EQ(context, output_gate_bias->dims->data[0], n_cell);
- TfLiteTensor* projection_weights =
+ const TfLiteTensor* projection_weights =
GetOptionalInputTensor(context, node, kProjectionWeightsTensor);
if (projection_weights) {
TF_LITE_ENSURE_EQ(context, projection_weights->dims->size, 2);
@@ -210,7 +210,7 @@ TfLiteStatus CheckInputTensorDimensions(TfLiteContext* context,
TF_LITE_ENSURE_EQ(context, projection_weights->dims->data[1], n_cell);
}
- TfLiteTensor* projection_bias =
+ const TfLiteTensor* projection_bias =
GetOptionalInputTensor(context, node, kProjectionBiasTensor);
if (projection_bias) {
TF_LITE_ENSURE_EQ(context, projection_bias->dims->size, 1);
@@ -298,7 +298,7 @@ TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) {
output_state->allocation_type = kTfLiteArenaRwPersistent;
cell_state->allocation_type = kTfLiteArenaRwPersistent;
- TfLiteTensor* input_to_input_weights =
+ const TfLiteTensor* input_to_input_weights =
GetOptionalInputTensor(context, node, kInputToInputWeightsTensor);
const bool use_cifg = (input_to_input_weights == nullptr);
if (use_cifg) {
@@ -324,7 +324,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
auto* params = reinterpret_cast<TfLiteLSTMParams*>(node->builtin_data);
const TfLiteTensor* input = GetInput(context, node, kInputTensor);
- TfLiteTensor* input_to_input_weights =
+ const TfLiteTensor* input_to_input_weights =
GetOptionalInputTensor(context, node, kInputToInputWeightsTensor);
const TfLiteTensor* input_to_forget_weights =
GetInput(context, node, kInputToForgetWeightsTensor);
@@ -333,7 +333,7 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* input_to_output_weights =
GetInput(context, node, kInputToOutputWeightsTensor);
- TfLiteTensor* recurrent_to_input_weights =
+ const TfLiteTensor* recurrent_to_input_weights =
GetOptionalInputTensor(context, node, kRecurrentToInputWeightsTensor);
const TfLiteTensor* recurrent_to_forget_weights =
GetInput(context, node, kRecurrentToForgetWeightsTensor);
@@ -342,14 +342,14 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* recurrent_to_output_weights =
GetInput(context, node, kRecurrentToOutputWeightsTensor);
- TfLiteTensor* cell_to_input_weights =
+ const TfLiteTensor* cell_to_input_weights =
GetOptionalInputTensor(context, node, kCellToInputWeightsTensor);
- TfLiteTensor* cell_to_forget_weights =
+ const TfLiteTensor* cell_to_forget_weights =
GetOptionalInputTensor(context, node, kCellToForgetWeightsTensor);
- TfLiteTensor* cell_to_output_weights =
+ const TfLiteTensor* cell_to_output_weights =
GetOptionalInputTensor(context, node, kCellToOutputWeightsTensor);
- TfLiteTensor* input_gate_bias =
+ const TfLiteTensor* input_gate_bias =
GetOptionalInputTensor(context, node, kInputGateBiasTensor);
const TfLiteTensor* forget_gate_bias =
GetInput(context, node, kForgetGateBiasTensor);
@@ -357,9 +357,9 @@ TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) {
const TfLiteTensor* output_gate_bias =
GetInput(context, node, kOutputGateBiasTensor);
- TfLiteTensor* projection_weights =
+ const TfLiteTensor* projection_weights =
GetOptionalInputTensor(context, node, kProjectionWeightsTensor);
- TfLiteTensor* projection_bias =
+ const TfLiteTensor* projection_bias =
GetOptionalInputTensor(context, node, kProjectionBiasTensor);
TfLiteTensor* output_state = GetOutput(context, node, kOutputStateTensor);