message: Restrict LSTM operator property to support only one variant of LSTM.
diff: @@ -26,6 +26,9 @@ namespace {
  // TODO(jianlijianli): extend it to support ops that has multiple variants.
  struct OpVariant {
  BuiltinOperator op_code;
  + bool use_layer_norm = false;
  + bool use_projection = false;
  + bool use_peephole = false;
  };
  const OpVariant GetOperatorVariant(const ModelT* model, int subgraph_index,
  @@ -34,6 +37,19 @@ const OpVariant GetOperatorVariant(const ModelT* model, int subgraph_index,
  OperatorT* op =
  model->subgraphs.at(subgraph_index)->operators[op_index].get();
  op_variant.op_code = model->operator_codes[op->opcode_index]->builtin_code;
  + if (op_variant.op_code == BuiltinOperator_LSTM) {
  + const int cell_to_output_weight_index = 11;
  + const int forget_layer_norm_coefficients_index = 21;
  + const int projection_weights_index = 16;
  + op_variant.use_projection = op->inputs[projection_weights_index] != -1;
  + op_variant.use_peephole = op->inputs[cell_to_output_weight_index] != -1;
  + if (op->inputs.size() == 20) {
  + op_variant.use_layer_norm = false;
  + } else {
  + op_variant.use_layer_norm =
  + op->inputs[forget_layer_norm_coefficients_index] != -1;
  + }
  + }
  return op_variant;
  }
  } // namespace
  @@ -180,6 +196,8 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index,
  // TODO(jianlijianli): extend this to other variants of LSTM.
  // LSTM needs 5 intermediate tensors. This agrees with the fully quantized
  // kernels in lstm_eval.cc
  + if (op_variant.use_layer_norm && op_variant.use_projection &&
  + !op_variant.use_peephole) {
  static const float alpha = static_cast<float>(std::pow(2, -10));
  TensorProperty tensor_property_12;
  @@ -221,9 +239,6 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index,
  {6, {}},
  {7, {}},
  {8, {}},
  - {9, {}},
  - {10, {}},
  - {11, {}},
  {16, {}},
  {19, tensor_property_19},
  {20, tensor_property_20},
  @@ -246,6 +261,9 @@ OperatorProperty GetOperatorProperty(const ModelT* model, int subgraph_index,
  };
  property.restrict_scale = {{18, 0}};
  property.version = 2;
  + } else {
  + property.quantizable = false;
  + }
  break;
  }
  case BuiltinOperator_L2_NORMALIZATION: {
  