Browse Source

add parser

tags/v0.7.0-beta
xuanyue 5 years ago
parent
commit
f18ec0cc57
100 changed files with 1250 additions and 110 deletions
  1. +3
    -1
      mindspore/lite/schema/model.fbs
  2. +18
    -1
      mindspore/lite/schema/ops.fbs
  3. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc
  4. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h
  5. +44
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.cc
  6. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.h
  7. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc
  8. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h
  9. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc
  10. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h
  11. +51
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.cc
  12. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.h
  13. +47
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.cc
  14. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.h
  15. +51
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.cc
  16. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.h
  17. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc
  18. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h
  19. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc
  20. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h
  21. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc
  22. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h
  23. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc
  24. +3
    -3
      mindspore/lite/tools/converter/parser/tflite/tflite_converter.h
  25. +50
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.cc
  26. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.h
  27. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc
  28. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h
  29. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc
  30. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h
  31. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.cc
  32. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.h
  33. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc
  34. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h
  35. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h
  36. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc
  37. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h
  38. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc
  39. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h
  40. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc
  41. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h
  42. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc
  43. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h
  44. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc
  45. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h
  46. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc
  47. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h
  48. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc
  49. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h
  50. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc
  51. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h
  52. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.cc
  53. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.h
  54. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.cc
  55. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.h
  56. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc
  57. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h
  58. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc
  59. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h
  60. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.cc
  61. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.h
  62. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.cc
  63. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.h
  64. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc
  65. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h
  66. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc
  67. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h
  68. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc
  69. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h
  70. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc
  71. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h
  72. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc
  73. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h
  74. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc
  75. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h
  76. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc
  77. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc
  78. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h
  79. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.cc
  80. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.h
  81. +45
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.cc
  82. +40
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.h
  83. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc
  84. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h
  85. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc
  86. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h
  87. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc
  88. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h
  89. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc
  90. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h
  91. +43
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.cc
  92. +41
    -0
      mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.h
  93. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc
  94. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h
  95. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc
  96. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h
  97. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc
  98. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h
  99. +1
    -1
      mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc
  100. +2
    -2
      mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h

+ 3
- 1
mindspore/lite/schema/model.fbs View File

@@ -187,7 +187,9 @@ union PrimitiveType {
DivGrad,
PowerGrad,
ActivationGrad,
PriorBox
PriorBox,
SpaceToBatchND,
TopKV2
}

enum QuantType: int {


+ 18
- 1
mindspore/lite/schema/ops.fbs View File

@@ -677,12 +677,16 @@ table SpaceToBatch {
}

table SparseToDense {
outputShape: [int];
sparseValue: [int];
defaultValue: [int];
validateIndices: bool;
}

table ReverseSequence {
seqAxis: int;
batchAxis: int;
seqLengths: [int];
}

table Rank {
@@ -781,6 +785,7 @@ table ScatterND {
}

table Unique {
outType: int;
}

table Unstack {
@@ -820,6 +825,7 @@ table OptMomentum {


table Where{
condition: [bool];
}

table OneHot {
@@ -829,7 +835,7 @@ table OneHot {
table Lstm{
bidirection: bool = false;
}
table PriorBox {
min_sizes: [int];
max_sizes: [int];
@@ -843,3 +849,14 @@ table PriorBox {
flip: bool = true;
offset: float;
}

table SpaceToBatchND {
blockShape : [int];
paddings : [int];
}

table TopKV2 {
k : [int];
sorted : bool = true;
}


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h"
#include "tools/converter/parser/tflite/tflite_add_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_add_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 44
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.cc View File

@@ -0,0 +1,44 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_addn_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteAddNParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteAddNParser";
std::unique_ptr<schema::AddNT> attr(new schema::AddNT());
attr->N = tflite_tensors.size();
if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_AddN;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteAddNParser("AddN", new TfliteAddNParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_addn_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_ADDN_PARSER_H
#define LITE_TFLITE_ADDN_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteAddNParser : public TfliteNodeParser {
public:
TfliteAddNParser() : TfliteNodeParser("AddN") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_ADDN_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h"
#include "tools/converter/parser/tflite/tflite_argmax_parser.h"
#include <memory>
#include <vector>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_argmax_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h"
#include "tools/converter/parser/tflite/tflite_argmin_parser.h"
#include <memory>
#include <vector>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_argmin_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 51
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.cc View File

@@ -0,0 +1,51 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_batch_to_space_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteBatchToSpaceParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteBatchToSpaceParser";
std::unique_ptr<schema::BatchToSpaceT> attr(new schema::BatchToSpaceT());
if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->blockShape)) {
MS_LOG(ERROR) << "batchToSpace -> blockShape get failed";
return RET_ERROR;
}
if (GetTfliteData(tflite_op->inputs[2], tflite_tensors, tflite_model_buffer, attr->crops)) {
MS_LOG(ERROR) << "batchToSpace -> crops get failed";
return RET_ERROR;
}

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_BatchToSpace;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteBatchToSpaceParser("BatchToSpace", new TfliteBatchToSpaceParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_batch_to_space_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_BATCH_TO_SPACE_PARSER_H
#define LITE_TFLITE_BATCH_TO_SPACE_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteBatchToSpaceParser : public TfliteNodeParser {
public:
TfliteBatchToSpaceParser() : TfliteNodeParser("BatchToSpace") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_BATCH_TO_SPACE_PARSER_H

+ 47
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.cc View File

@@ -0,0 +1,47 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_broadcast_to_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteBroadcastToParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteBroadcastToParser";
std::unique_ptr<schema::BroadcastToT> attr(new schema::BroadcastToT());
if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->dst_shape)) {
MS_LOG(ERROR) << "broadCastTo -> dst_shape get failed";
return RET_ERROR;
}

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_BroadcastTo;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteBroadcastToParser("BroadcastTo", new TfliteBroadcastToParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_broadcast_to_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_BROADCAST_TO_PARSER_H
#define LITE_TFLITE_BROADCAST_TO_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteBroadcastToParser : public TfliteNodeParser {
public:
TfliteBroadcastToParser() : TfliteNodeParser("BroadcastTo") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_BROADCAST_TO_PARSER_H

+ 51
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.cc View File

@@ -0,0 +1,51 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_cast_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteCastParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteCastParser";
std::unique_ptr<schema::CastT> attr(new schema::CastT());
const auto &tflite_attr = tflite_op->builtin_options.AsCastOptions();
if (tflite_attr == nullptr) {
MS_LOG(ERROR) << "get op:" << op->name.c_str() << " attr failed";
return RET_NULL_PTR;
}

attr->srcT = tflite_attr->in_data_type;
attr->dstT = tflite_attr->out_data_type;

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_Cast;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteCastParser("Cast", new TfliteCastParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_cast_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_CAST_PARSER_H
#define LITE_TFLITE_CAST_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteCastParser : public TfliteNodeParser {
public:
TfliteCastParser() : TfliteNodeParser("Cast") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_CAST_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h"
#include "tools/converter/parser/tflite/tflite_ceil_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_ceil_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h"
#include "tools/converter/parser/tflite/tflite_concat_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_concat_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h"
#include "tools/converter/parser/tflite/tflite_conv_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_conv_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_converter.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_converter.h"
#include "tools/converter/parser/tflite/tflite_converter.h"

namespace mindspore {
namespace lite {


+ 3
- 3
mindspore/lite/tools/converter/parser/tflite/tflite_converter.h View File

@@ -19,9 +19,9 @@

#include <string>
#include <memory>
#include "mindspore/lite/tools/converter/converter.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h"
#include "mindspore/lite/tools/converter/graphdef_transform.h"
#include "tools/converter/converter.h"
#include "tools/converter/parser/tflite/tflite_model_parser.h"
#include "tools/converter/graphdef_transform.h"

namespace mindspore {
namespace lite {


+ 50
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.cc View File

@@ -0,0 +1,50 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_depth_to_space_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteDepthToSpaceParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteDepthToSpaceParser";
std::unique_ptr<schema::DepthToSpaceT> attr(new schema::DepthToSpaceT());
const auto &tflite_attr = tflite_op->builtin_options.AsDepthToSpaceOptions();
if (tflite_attr == nullptr) {
MS_LOG(ERROR) << "get op: %s attr failed", op->name.c_str();
return RET_NULL_PTR;
}
attr->blockSize = tflite_attr->block_size;
attr->format = schema::Format_NHWC;

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_DepthToSpace;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteDepthToSpaceParser("DepthToSpace", new TfliteDepthToSpaceParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_depth_to_space_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H
#define LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteDepthToSpaceParser : public TfliteNodeParser {
public:
TfliteDepthToSpaceParser() : TfliteNodeParser("DepthToSpace") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_DEPTH_TO_SPACE_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h"
#include "tools/converter/parser/tflite/tflite_depthwise_conv_parser.h"
#include "tools/common/node_util.h"

namespace mindspore {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_depthwise_conv_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h"
#include "tools/converter/parser/tflite/tflite_div_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_div_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_equal_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteEqualParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteEqualParser";
std::unique_ptr<schema::EqualT> attr(new schema::EqualT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_Equal;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteEqualParser("Equal", new TfliteEqualParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_equal_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_EQUAL_PARSER_H
#define LITE_TFLITE_EQUAL_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteEqualParser : public TfliteNodeParser {
public:
TfliteEqualParser() : TfliteNodeParser("Equal") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_EQUAL_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h"
#include "tools/converter/parser/tflite/tflite_expand_dims_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_expand_dims_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_fakequant_parser.h View File

@@ -18,8 +18,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h"
#include "tools/converter/parser/tflite/tflite_fill_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_fill_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h"
#include "tools/converter/parser/tflite/tflite_floor_div_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_floor_div_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h"
#include "tools/converter/parser/tflite/tflite_floor_mod_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_floor_mod_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h"
#include "tools/converter/parser/tflite/tflite_floor_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_floor_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h"
#include "tools/converter/parser/tflite/tflite_fullyconnected_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_fullyconnected_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h"
#include "tools/converter/parser/tflite/tflite_gather_nd_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_gather_nd_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h"
#include "tools/converter/parser/tflite/tflite_gather_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_gather_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h"
#include "tools/converter/parser/tflite/tflite_gather_v2_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_gather_v2_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_greater_equal_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteGreaterEqualParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteGreaterEqualParser";
std::unique_ptr<schema::GreaterEqualT> attr(new schema::GreaterEqualT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_GreaterEqual;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteGreaterEqualParser("GreaterEqual", new TfliteGreaterEqualParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_greater_equal_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_GREATER_EQUAL_PARSER_H
#define LITE_TFLITE_GREATER_EQUAL_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteGreaterEqualParser : public TfliteNodeParser {
public:
TfliteGreaterEqualParser() : TfliteNodeParser("GreaterEqual") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_GREATER_EQUAL_PARSER_H

+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_greater_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteGreaterParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteGreaterParser";
std::unique_ptr<schema::GreaterT> attr(new schema::GreaterT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_Greater;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteGreaterParser("Greater", new TfliteGreaterParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_greater_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_GREATER_PARSER_H
#define LITE_TFLITE_GREATER_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteGreaterParser : public TfliteNodeParser {
public:
TfliteGreaterParser() : TfliteNodeParser("Greater") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_GREATER_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h"
#include "tools/converter/parser/tflite/tflite_inner_product_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_inner_product_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.cc View File

@@ -16,7 +16,7 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h"
#include "tools/converter/parser/tflite/tflite_leaky_relu_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_leaky_relu_parser.h View File

@@ -17,8 +17,8 @@
#ifndef PREDICT_TFLITE_LEAKY_RELU_PARSER_H
#define PREDICT_TFLITE_LEAKY_RELU_PARSER_H

#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include <vector>
#include <memory>



+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_less_equal_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteLessEqualParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteLessEqualParser";
std::unique_ptr<schema::LessEqualT> attr(new schema::LessEqualT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_LessEqual;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteLessEqualParser("LessEqual", new TfliteLessEqualParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_less_equal_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_LESS_EQUAL_PARSER_H
#define LITE_TFLITE_LESS_EQUAL_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteLessEqualParser : public TfliteNodeParser {
public:
TfliteLessEqualParser() : TfliteNodeParser("LessEqual") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_LESS_EQUAL_PARSER_H

+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_less_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteLessParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteLessParser";
std::unique_ptr<schema::LessT> attr(new schema::LessT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_Less;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteLessParser("Less", new TfliteLessParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_less_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_LESS_PARSER_H
#define LITE_TFLITE_LESS_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteLessParser : public TfliteNodeParser {
public:
TfliteLessParser() : TfliteNodeParser("Less") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_LESS_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h"
#include "tools/converter/parser/tflite/tflite_logistic_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_logistic_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h"
#include "tools/converter/parser/tflite/tflite_lrn_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_lrn_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h"
#include "tools/converter/parser/tflite/tflite_max_pooling_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_max_pooling_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h"
#include "tools/converter/parser/tflite/tflite_mean_pooling_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_mean_pooling_parser.h View File

@@ -19,8 +19,8 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h"
#include "tools/converter/parser/tflite/tflite_model_parser.h"
#include <fstream>
#include <utility>
#include <memory>


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_model_parser.h View File

@@ -29,8 +29,8 @@
#include <map>

#include "securec/include/securec.h"
#include "mindspore/lite/tools/converter/model_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/model_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/common/tensor_util.h"

#include "mindspore/lite/schema/inner/model_generated.h"


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h"
#include "tools/converter/parser/tflite/tflite_mul_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_mul_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.cc View File

@@ -18,7 +18,7 @@
#include <memory>
#include <unordered_map>
#include "securec/include/securec.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h View File

@@ -20,7 +20,7 @@
#include <string>
#include <unordered_map>
#include "tools/common/node_util.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"

namespace mindspore {
namespace lite {


+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_not_equal_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteNotEqualParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteNotEqualParser";
std::unique_ptr<schema::NotEqualT> attr(new schema::NotEqualT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_NotEqual;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteNotEqualParser("NotEqual", new TfliteNotEqualParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_not_equal_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_NOT_EQUAL_PARSER_H
#define LITE_TFLITE_NOT_EQUAL_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteNotEqualParser : public TfliteNodeParser {
public:
TfliteNotEqualParser() : TfliteNodeParser("NotEqual") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_NOT_EQUAL_PARSER_H

+ 45
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.cc View File

@@ -0,0 +1,45 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_p_relu_parser.h"

namespace mindspore {
namespace lite {
STATUS TflitePreluParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op, TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "paser TflitePreluParser";
std::unique_ptr<schema::PreluT> attr(new schema::PreluT());
if (GetTfliteData(tflite_op->inputs[1], tflite_tensors, tflite_model_buffer, attr->slope)) {
MS_LOG(ERROR) << "pRelu -> slope get failed";
return RET_ERROR;
}
if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_Prelu;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tflitePreluParser("Prelu", new TflitePreluParser());
} // namespace lite
} // namespace mindspore

+ 40
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_p_relu_parser.h View File

@@ -0,0 +1,40 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_P_RELU_PARSER_H
#define LITE_TFLITE_P_RELU_PARSER_H

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TflitePreluParser : public TfliteNodeParser {
public:
TflitePreluParser() : TfliteNodeParser("Prelu") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_P_RELU_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h"
#include "tools/converter/parser/tflite/tflite_pad_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_pad_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h"
#include "tools/converter/parser/tflite/tflite_pow_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_pow_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h"
#include "tools/converter/parser/tflite/tflite_range_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_range_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.cc View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h"
#include "tools/converter/parser/tflite/tflite_rank_parser.h"
#include <vector>
#include <memory>



+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_rank_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 43
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.cc View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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,
* distributed under the License is distributed on an AS
* 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.
*/

#include <vector>
#include <memory>
#include "tools/converter/parser/tflite/tflite_real_div_parser.h"

namespace mindspore {
namespace lite {
STATUS TfliteRealDivParser::Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset,
schema::CNodeT *op,
TensorCache *tensor_cache, bool quantized_model) {
MS_LOG(DEBUG) << "parse TfliteRealDivParser";
std::unique_ptr<schema::RealDivT> attr(new schema::RealDivT());

if (op != nullptr) {
op->primitive = std::make_unique<schema::PrimitiveT>();
op->primitive->value.type = schema::PrimitiveType_RealDiv;
op->primitive->value.value = attr.release();
}
return RET_OK;
}

TfliteNodeRegister g_tfliteRealDivParser("RealDiv", new TfliteRealDivParser());
} // namespace lite
} // namespace mindspore

+ 41
- 0
mindspore/lite/tools/converter/parser/tflite/tflite_real_div_parser.h View File

@@ -0,0 +1,41 @@
/**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* 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 LITE_TFLITE_REAL_DIV_PARSER_H
#define LITE_TFLITE_REAL_DIV_PARSER_H

#include <memory>
#include <vector>
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {
class TfliteRealDivParser : public TfliteNodeParser {
public:
TfliteRealDivParser() : TfliteNodeParser("RealDiv") {}

STATUS Parse(const std::unique_ptr<tflite::OperatorT> &tflite_op,
const std::vector<std::unique_ptr<tflite::TensorT>> &tflite_tensors,
const std::vector<std::unique_ptr<tflite::BufferT>> &tflite_model_buffer,
const std::vector<std::unique_ptr<tflite::OperatorCodeT>> &tflite_opset, schema::CNodeT *op,
TensorCache *tensor_cache,
bool quantized_model) override;
};
} // namespace lite
} // namespace mindspore

#endif // LITE_TFLITE_REAL_DIV_PARSER_H

+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.cc View File

@@ -16,7 +16,7 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h"
#include "tools/converter/parser/tflite/tflite_relu6_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_relu6_parser.h View File

@@ -17,8 +17,8 @@
#ifndef PREDICT_TFLITE_RELU6_PARSER_H
#define PREDICT_TFLITE_RELU6_PARSER_H

#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include <vector>
#include <memory>



+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.cc View File

@@ -16,7 +16,7 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h"
#include "tools/converter/parser/tflite/tflite_relu_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_relu_parser.h View File

@@ -17,8 +17,8 @@
#ifndef PREDICT_TFLITE_RELU_PARSER_H
#define PREDICT_TFLITE_RELU_PARSER_H

#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include <vector>
#include <memory>



+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h"
#include "tools/converter/parser/tflite/tflite_reshape_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_reshape_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


+ 1
- 1
mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.cc View File

@@ -16,7 +16,7 @@

#include <vector>
#include <memory>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h"
#include "tools/converter/parser/tflite/tflite_resize_bilinear_parser.h"

namespace mindspore {
namespace lite {


+ 2
- 2
mindspore/lite/tools/converter/parser/tflite/tflite_resize_bilinear_parser.h View File

@@ -19,8 +19,8 @@

#include <memory>
#include <vector>
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h"
#include "mindspore/lite/tools/converter/parser/tflite/tflite_node_parser_registry.h"
#include "tools/converter/parser/tflite/tflite_node_parser.h"
#include "tools/converter/parser/tflite/tflite_node_parser_registry.h"

namespace mindspore {
namespace lite {


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save