From 60b7d06456662f6a004608a54e17035a15aac0f1 Mon Sep 17 00:00:00 2001 From: Jian Li Date: Tue, 5 Nov 2019 14:04:23 -0800 Subject: [PATCH] Add LSTM to op spec. This CL only adds the intermediates fields for one variants of LSTM. PiperOrigin-RevId: 278703956 Change-Id: I4468e546d4a1096b7345d4e96701fec7d4f8ec59 --- tensorflow/lite/tools/optimize/operator_property.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tensorflow/lite/tools/optimize/operator_property.cc b/tensorflow/lite/tools/optimize/operator_property.cc index c30f7544467..85a5e839e37 100644 --- a/tensorflow/lite/tools/optimize/operator_property.cc +++ b/tensorflow/lite/tools/optimize/operator_property.cc @@ -165,6 +165,15 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index, property.version = 2; break; } + case BuiltinOperator_LSTM: { + // TODO(jianlijianli): extend LSTM op spec to inlucde input, bias etc. + // TODO(jianlijianli): extend this to other variants of LSTM. + // LSTM need 5 intermediate tensors. This agrees with the fully quantized + // kernels in lstm_eval.cc + property.intermediates = {{0, {}}, {1, {}}, {2, {}}, {3, {}}, {4, {}}}; + property.version = 2; + break; + } case BuiltinOperator_L2_NORMALIZATION: { property.inputs = {{0, {}}}; // L2 Norm requires output with 1/128 as scale and 0 as zero point.