message: Add support for TransposeConv to EstimateArithmeticOpsCount().
diff: @@ -1897,6 +1897,26 @@ bool EstimateArithmeticOpsCount(const Model& model, const Operator& op,
  }
  break;
  }
  + case OperatorType::kTransposeConv: {
  + const auto& input_array = model.GetArray(op.inputs[2]);
  + const auto& weights_array = model.GetArray(op.inputs[1]);
  + if (!input_array.has_shape() || !weights_array.has_shape()) {
  + return false;
  + }
  + const Shape& input = input_array.shape();
  + const Shape& weights = weights_array.shape();
  + // Compute op count from the seven nested loops of
  + // tflite::reference_ops::TransposeConv():
  + *result = 2 * input.dims(0) * input.dims(1) * input.dims(2) *
  + input.dims(3) * weights.dims(1) * weights.dims(2) *
  + weights.dims(0);
  + // Note that tflite::optimized_ops::TransposeConv() uses an im2col matrix
  + // and has a higher op count, by a factor of (output_height*output_width)
  + // vs. (input_height*input_width). Yet it generally performs better
  + // because of coherent memory access. (At least for 2x2 striding. But not
  + // likely for all cases.)
  + break;
  + }
  case OperatorType::kAdd:
  case OperatorType::kSub:
  case OperatorType::kMul: {
  