diff options
Diffstat (limited to 'compiler/exo')
42 files changed, 216 insertions, 217 deletions
diff --git a/compiler/exo/CMakeLists.txt b/compiler/exo/CMakeLists.txt index 79c75ef2e..697c39dd9 100644 --- a/compiler/exo/CMakeLists.txt +++ b/compiler/exo/CMakeLists.txt @@ -1,4 +1,4 @@ -nnas_find_package(FlatBuffers QUIET) +nnas_find_package(FlatBuffers EXACT 23.5.26 QUIET) if(NOT FlatBuffers_FOUND) message(STATUS "Build exo: FALSE (missing FlatBuffers)") @@ -15,7 +15,7 @@ endif(NOT TensorFlowSource_FOUND) message(STATUS "Build exo: TRUE") set(TFLITE_SCHEMA_DIR "${TensorFlowSource_DIR}/tensorflow/lite/schema") -set(CIRCLE_SCHEMA_DIR "${NNAS_PROJECT_SOURCE_DIR}/nnpackage/schema") +set(CIRCLE_SCHEMA_DIR "${NNAS_PROJECT_SOURCE_DIR}/res/CircleSchema/0.3") FlatBuffers_Target(exo_tflite_fbs OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/gen" @@ -39,7 +39,6 @@ target_include_directories(exo PRIVATE src) target_link_libraries(exo PUBLIC exo_tflite_fbs) target_link_libraries(exo PUBLIC exo_circle_fbs) target_link_libraries(exo PUBLIC loco) -target_link_libraries(exo PRIVATE stdex) target_link_libraries(exo PRIVATE pepper_str) target_link_libraries(exo PRIVATE pepper_strcast) target_link_libraries(exo PRIVATE locoex_customop) @@ -64,7 +63,6 @@ nnas_find_package(GTest REQUIRED) GTest_AddTest(exo_test ${TESTS}) target_include_directories(exo_test PRIVATE src) -target_link_libraries(exo_test stdex) target_link_libraries(exo_test pepper_str) target_link_libraries(exo_test exo) target_link_libraries(exo_test hermes_std) diff --git a/compiler/exo/exclude.me b/compiler/exo/exclude.me new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/compiler/exo/exclude.me diff --git a/compiler/exo/requires.cmake b/compiler/exo/requires.cmake index 6378b942d..3116c5757 100644 --- a/compiler/exo/requires.cmake +++ b/compiler/exo/requires.cmake @@ -1,4 +1,3 @@ -require("stdex") require("loco") require("locoex-customop") require("logo") diff --git a/compiler/exo/src/Circle/CircleExporter.cpp b/compiler/exo/src/Circle/CircleExporter.cpp index 797749090..cfcb9a258 100644 --- a/compiler/exo/src/Circle/CircleExporter.cpp +++ b/compiler/exo/src/Circle/CircleExporter.cpp @@ -18,16 +18,15 @@ #include "CircleExporterImpl.h" -#include <stdex/Memory.h> - #include <oops/InternalExn.h> +#include <memory> #include <fstream> namespace exo { -CircleExporter::CircleExporter(loco::Graph *graph) : _impl(stdex::make_unique<Impl>(graph)) +CircleExporter::CircleExporter(loco::Graph *graph) : _impl(std::make_unique<Impl>(graph)) { // NOTHING TO DO } diff --git a/compiler/exo/src/Circle/CircleExporterImpl.cpp b/compiler/exo/src/Circle/CircleExporterImpl.cpp index 4cba33da1..a93931597 100644 --- a/compiler/exo/src/Circle/CircleExporterImpl.cpp +++ b/compiler/exo/src/Circle/CircleExporterImpl.cpp @@ -88,7 +88,7 @@ encodeOperatorCodes(FlatBufferBuilder &builder, std::unordered_map<OpCode, uint3 INTERNAL_EXN("Cannot find code for customop even though opcode is BuiltinOperator_CUSTOM"); operator_codes_vec[idx] = - CreateOperatorCode(builder, it.first.opcode, builder.CreateString(custom_code->second)); + CreateOperatorCode(builder, it.first.opcode, builder.CreateString(custom_code->second)); } } return builder.CreateVector(operator_codes_vec); @@ -148,7 +148,7 @@ void CircleExporter::Impl::exportGraph(loco::Graph *graph) // encode operator codes auto operator_codes = - encodeOperatorCodes(_builder, gd._operator_codes, gd._custom_operator_codes); + encodeOperatorCodes(_builder, gd._operator_codes, gd._custom_operator_codes); // Subgraphs Offset<SubGraph> subgraph = exportSubgraph(gd); diff --git a/compiler/exo/src/Circle/CircleExporterUtils.cpp b/compiler/exo/src/Circle/CircleExporterUtils.cpp index 12b204ce7..079f115f6 100644 --- a/compiler/exo/src/Circle/CircleExporterUtils.cpp +++ b/compiler/exo/src/Circle/CircleExporterUtils.cpp @@ -78,13 +78,13 @@ circle::Padding getOpPadding(const loco::Padding2D *pad, const loco::Stride<2> * // // NOTE input and output 'feature' map are shape of NHWC bool same_padding_criterion_1 = - (static_cast<uint32_t>(ofm._dims[1]) == (ifm._dims[1] - 1) / stride->vertical() + 1) && - (static_cast<uint32_t>(ofm._dims[2]) == (ifm._dims[2] - 1) / stride->horizontal() + 1); + (static_cast<uint32_t>(ofm._dims[1]) == (ifm._dims[1] - 1) / stride->vertical() + 1) && + (static_cast<uint32_t>(ofm._dims[2]) == (ifm._dims[2] - 1) / stride->horizontal() + 1); // For same padding, rear padding is same or bigger than front padding by at most 1 bool same_padding_criterion_2 = - (pad->top() <= pad->bottom()) && (pad->bottom() <= pad->top() + 1) && - (pad->left() <= pad->right()) && (pad->right() <= pad->left() + 1); + (pad->top() <= pad->bottom()) && (pad->bottom() <= pad->top() + 1) && + (pad->left() <= pad->right()) && (pad->right() <= pad->left() + 1); if (same_padding_criterion_1 && same_padding_criterion_2) return circle::Padding_SAME; @@ -123,8 +123,7 @@ void registerGraphIOName(loco::Graph *graph, SerializedModelData &gd) gd._data_format = circle::DataFormat::DataFormat_CHANNELS_LAST; } -#include <stdex/Memory.h> - +#include <memory> #include <cassert> namespace @@ -150,7 +149,7 @@ private: void set_tensor_index(loco::Node *node, const TFLTensorIndex &tensor_id) { assert(node->annot<TFLTensorIndexAnnotation>() == nullptr); - node->annot(stdex::make_unique<TFLTensorIndexAnnotation>(tensor_id)); + node->annot(std::make_unique<TFLTensorIndexAnnotation>(tensor_id)); } TFLTensorIndex get_tensor_index(loco::Node *node) diff --git a/compiler/exo/src/Circle/CircleExporterUtils.h b/compiler/exo/src/Circle/CircleExporterUtils.h index fdd162bae..78f0cf7ed 100644 --- a/compiler/exo/src/Circle/CircleExporterUtils.h +++ b/compiler/exo/src/Circle/CircleExporterUtils.h @@ -65,7 +65,7 @@ namespace circle_detail { /** - * @breif Record the information of T/F Lite SubGraph and its mapping to loco + * @brief Record the information of T/F Lite SubGraph and its mapping to loco */ struct SubGraphContext { diff --git a/compiler/exo/src/Circle/CircleOperationExporter.cpp b/compiler/exo/src/Circle/CircleOperationExporter.cpp index 390e2ec99..8b7337011 100644 --- a/compiler/exo/src/Circle/CircleOperationExporter.cpp +++ b/compiler/exo/src/Circle/CircleOperationExporter.cpp @@ -89,13 +89,19 @@ public: void visit(loco::ReLU *) final; void visit(loco::ReLU6 *) final; void visit(loco::Tanh *) final; - void visit(loco::Push *) final { /* DO NOTHING */} - void visit(loco::Pull *) final { /* DO NOTHING */} + void visit(loco::Push *) final + { /* DO NOTHING */ + } + void visit(loco::Pull *) final + { /* DO NOTHING */ + } void visit(loco::FeatureEncode *) final; void visit(loco::FeatureDecode *) final; void visit(loco::FilterEncode *) final; void visit(loco::DepthwiseFilterEncode *) final; - void visit(loco::ConstGen *) final { /* skip, everything is done in exportOpDefinedTensors */} + void visit(loco::ConstGen *) final + { /* skip, everything is done in exportOpDefinedTensors */ + } void visit(loco::MaxPool2D *) final; void visit(loco::AvgPool2D *) final; void visit(loco::Conv2D *) final; @@ -235,7 +241,7 @@ void OperationExporter::visit(locoex::TFLFullyConnected *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); auto options = - CreateFullyConnectedOptions(builder, to_circle_actfunc(node->fusedActivationFunction())); + CreateFullyConnectedOptions(builder, to_circle_actfunc(node->fusedActivationFunction())); // Make FULLY_CONNECTED operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -375,8 +381,8 @@ void OperationExporter::visit(locoex::TFLTranspose *node) auto options = CreateTransposeOptions(builder); auto op_offset = - CreateOperator(builder, op_idx, inputs, outputs, - circle::BuiltinOptions::BuiltinOptions_TransposeOptions, options.Union()); + CreateOperator(builder, op_idx, inputs, outputs, + circle::BuiltinOptions::BuiltinOptions_TransposeOptions, options.Union()); gd._operators.push_back(op_offset); } @@ -393,7 +399,7 @@ void OperationExporter::visit(locoex::TFLTransposeConv *node) auto outputs = builder.CreateVector(outputs_vec); circle::Padding padding = getOpPadding(node->padding()); auto options = - CreateTransposeConvOptions(builder, padding, node->stride()->w(), node->stride()->h()); + CreateTransposeConvOptions(builder, padding, node->stride()->w(), node->stride()->h()); // Make TRANSPOSE_CONV operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -405,7 +411,7 @@ template <class TFLPool2D> void OperationExporter::export_pool_2d(TFLPool2D *node, circle::BuiltinOperator builtin_op) { EXO_ASSERT(builtin_op == circle::BuiltinOperator_MAX_POOL_2D || - builtin_op == circle::BuiltinOperator_AVERAGE_POOL_2D, + builtin_op == circle::BuiltinOperator_AVERAGE_POOL_2D, "should be maxpool or avgpool"); EXO_ASSERT(node->padding() != locoex::Padding::UNDEFINED, "Padding is not set"); @@ -481,10 +487,10 @@ void OperationExporter::visit(loco::MaxPool2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); circle::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreatePool2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), node->window()->horizontal(), - node->window()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreatePool2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical(), + node->window()->horizontal(), node->window()->vertical()); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, circle::BuiltinOptions_Pool2DOptions, options.Union()); gd._operators.push_back(op_offset); @@ -501,10 +507,10 @@ void OperationExporter::visit(loco::AvgPool2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); circle::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreatePool2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), node->window()->horizontal(), - node->window()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreatePool2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical(), + node->window()->horizontal(), node->window()->vertical()); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, circle::BuiltinOptions_Pool2DOptions, options.Union()); gd._operators.push_back(op_offset); @@ -527,7 +533,7 @@ void OperationExporter::visit(loco::Conv2D *node) std::vector<float> bias_vec_data(bias_vec_size); // initialized as zero vector auto bias_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); auto bias_buffer_offset = CreateBuffer(builder, bias_vec_offset); @@ -539,7 +545,7 @@ void OperationExporter::visit(loco::Conv2D *node) auto name_offset = builder.CreateString("t_" + std::to_string(bias_tensor_id)); auto bias_tensor_offset = - CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); + CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); gd._tensors.push_back(bias_tensor_offset); // Make input, output and options for operator @@ -549,9 +555,9 @@ void OperationExporter::visit(loco::Conv2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); circle::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreateConv2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreateConv2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical()); // Make CONV_2D operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -581,7 +587,7 @@ void OperationExporter::visit(loco::TransposedConv2D *node) } auto outshape_vec_offset = builder.CreateVector( - reinterpret_cast<uint8_t *>(outshape_vec_data.data()), raw_outshape_vec_size); + reinterpret_cast<uint8_t *>(outshape_vec_data.data()), raw_outshape_vec_size); auto outshape_buffer_offset = CreateBuffer(builder, outshape_vec_offset); @@ -630,7 +636,7 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) size_t raw_bias_vec_size = bias_vec_size * sizeof(int32_t); std::vector<float> bias_vec_data(bias_vec_size); auto bias_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); auto bias_buffer_offset = CreateBuffer(builder, bias_vec_offset); @@ -642,7 +648,7 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) auto name_offset = builder.CreateString("t_" + std::to_string(bias_tensor_id)); auto bias_tensor_offset = - CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); + CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); gd._tensors.push_back(bias_tensor_offset); std::vector<int32_t> inputs_vec{get_tensor_index(node->ifm()), get_tensor_index(node->ker()), @@ -651,13 +657,13 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); circle::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); int32_t ifm_channel_size = ShapeInference::get(node->ifm())._dims[3]; // multiplier = bias_vec_size(output_size)/ifm_channel_size auto options = - CreateDepthwiseConv2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), bias_vec_size / ifm_channel_size); + CreateDepthwiseConv2DOptions(builder, padding, node->stride()->horizontal(), + node->stride()->vertical(), bias_vec_size / ifm_channel_size); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, circle::BuiltinOptions_DepthwiseConv2DOptions, options.Union()); @@ -691,7 +697,7 @@ void OperationExporter::visit(loco::TensorReduce *node) size_t raw_axes_vec_size = axes_vec_size * sizeof(int32_t); auto axes_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(axes_vec.data()), raw_axes_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(axes_vec.data()), raw_axes_vec_size); auto axes_buffer_offset = CreateBuffer(builder, axes_vec_offset); @@ -703,7 +709,7 @@ void OperationExporter::visit(loco::TensorReduce *node) auto name_offset = builder.CreateString("t_" + std::to_string(axes_tensor_id)); auto axes_tensor_offset = - CreateTensor(builder, axes_vec_shape_offset, TensorType_INT32, axes_buffer_id, name_offset); + CreateTensor(builder, axes_vec_shape_offset, TensorType_INT32, axes_buffer_id, name_offset); gd._tensors.push_back(axes_tensor_offset); std::vector<int32_t> inputs_vec{get_tensor_index(node->input()), axes_tensor_id}; @@ -766,7 +772,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, constexpr size_t raw_perm_vec_size = perm_vec_size * sizeof(int32_t); auto perm_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(perm_vec_data.data()), raw_perm_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(perm_vec_data.data()), raw_perm_vec_size); auto perm_buffer_offset = CreateBuffer(builder, perm_vec_offset); @@ -778,7 +784,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, auto name_offset = builder.CreateString("t_" + std::to_string(perm_tensor_id)); auto perm_tensor_offset = - CreateTensor(builder, perm_vec_shape_offset, TensorType_INT32, perm_buffer_id, name_offset); + CreateTensor(builder, perm_vec_shape_offset, TensorType_INT32, perm_buffer_id, name_offset); gd._tensors.push_back(perm_tensor_offset); // Create permutation node @@ -792,7 +798,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, constexpr auto options_type = circle::BuiltinOptions::BuiltinOptions_TransposeOptions; auto transpose_offset = - CreateOperator(builder, op_idx, inputs, outputs, options_type, options.Union()); + CreateOperator(builder, op_idx, inputs, outputs, options_type, options.Union()); gd._operators.push_back(transpose_offset); } @@ -878,11 +884,11 @@ void exportAsReshape(loco::Node *node, FlatBufferBuilder &builder, // but also by input. auto input_shape_shape_vec_offset = - builder.CreateVector(std::vector<int32_t>{(int32_t)new_shape_vec.size()}); + builder.CreateVector(std::vector<int32_t>{(int32_t)new_shape_vec.size()}); size_t input_shape_vec_size = new_shape_vec.size() * sizeof(int32_t); auto input_shape_input_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(new_shape_vec.data()), input_shape_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(new_shape_vec.data()), input_shape_vec_size); auto input_shape_buffer_offset = CreateBuffer(builder, input_shape_input_vec_offset); const auto input_shape_buffer_id = static_cast<uint32_t>(gd._buffers.size()); @@ -891,7 +897,7 @@ void exportAsReshape(loco::Node *node, FlatBufferBuilder &builder, auto input_shape_tensor_id = static_cast<int32_t>(gd._tensors.size()); auto name_offset = builder.CreateString("t_" + std::to_string(input_shape_tensor_id)); auto input_shape_tensor_offset = CreateTensor( - builder, input_shape_shape_vec_offset, TensorType_INT32, input_shape_buffer_id, name_offset); + builder, input_shape_shape_vec_offset, TensorType_INT32, input_shape_buffer_id, name_offset); gd._tensors.push_back(input_shape_tensor_offset); uint32_t op_idx = gd.registerBuiltinOpcode(circle::BuiltinOperator_RESHAPE); @@ -1093,7 +1099,7 @@ void OperationExporter::visit(loco::TensorConstantPad *node) auto padding_shape_vec_ptr = builder.CreateVector(std::vector<int32_t>{padding_vec_size, 2}); // create tensor auto padding_tensor_ptr = - CreateTensor(builder, padding_shape_vec_ptr, TensorType_INT32, padding_buffer_id); + CreateTensor(builder, padding_shape_vec_ptr, TensorType_INT32, padding_buffer_id); // get tensor id const auto padding_tensor_id = static_cast<int32_t>(gd._tensors.size()); diff --git a/compiler/exo/src/Circle/CircleTypeInference.cpp b/compiler/exo/src/Circle/CircleTypeInference.cpp index a1e92b884..d3d01b4af 100644 --- a/compiler/exo/src/Circle/CircleTypeInference.cpp +++ b/compiler/exo/src/Circle/CircleTypeInference.cpp @@ -31,8 +31,6 @@ #include <oops/InternalExn.h> -#include <stdex/Memory.h> - #include <stdexcept> #include <type_traits> diff --git a/compiler/exo/src/Conversion/DepthwiseConv2DConverter.cpp b/compiler/exo/src/Conversion/DepthwiseConv2DConverter.cpp index e3884c3cc..32ad44385 100644 --- a/compiler/exo/src/Conversion/DepthwiseConv2DConverter.cpp +++ b/compiler/exo/src/Conversion/DepthwiseConv2DConverter.cpp @@ -25,6 +25,8 @@ #include <loco/Service/TypeInference.h> #include <loco/Service/ShapeInference.h> +#include <limits> + namespace exo { @@ -75,9 +77,9 @@ bool DepthwiseConv2DConverter::convert(loco::DepthwiseConv2D *origin) reshape->tensor(filter_dec); int32_t new_shape[4] = { - 1, static_cast<int32_t>(filter_shape.height().value()), - static_cast<int32_t>(filter_shape.width().value()), - static_cast<int32_t>(filter_shape.depth().value() * filter_shape.multiplier().value())}; + 1, static_cast<int32_t>(filter_shape.height().value()), + static_cast<int32_t>(filter_shape.width().value()), + static_cast<int32_t>(filter_shape.depth().value() * filter_shape.multiplier().value())}; locoex::set_new_shape(reshape, new_shape, 4); tfl_dw_conv2d->filter(reshape); diff --git a/compiler/exo/src/Convert.cpp b/compiler/exo/src/Convert.cpp index 45f0481f4..3a578eee8 100644 --- a/compiler/exo/src/Convert.cpp +++ b/compiler/exo/src/Convert.cpp @@ -32,7 +32,7 @@ #include <logo/RemoveForwardNodePass.h> #include <logo/Phase.h> -#include <stdex/Memory.h> +#include <memory> namespace exo { @@ -49,40 +49,40 @@ void convert_to_TFLNodes(loco::Graph *graph) logo::Phase phase; { // prepare type and shape before conversion - phase.emplace_back(stdex::make_unique<TypeInferencePass>()); - phase.emplace_back(stdex::make_unique<ShapeInferencePass>()); + phase.emplace_back(std::make_unique<TypeInferencePass>()); + phase.emplace_back(std::make_unique<ShapeInferencePass>()); // Add converters for canonical nodes. Note: Not all loco canonical nodes are listed. - phase.emplace_back(stdex::make_unique<AvgPool2DConverter>()); - phase.emplace_back(stdex::make_unique<ConstGenConverter>()); - phase.emplace_back(stdex::make_unique<Conv2DConverter>()); - phase.emplace_back(stdex::make_unique<DepthwiseConv2DConverter>()); + phase.emplace_back(std::make_unique<AvgPool2DConverter>()); + phase.emplace_back(std::make_unique<ConstGenConverter>()); + phase.emplace_back(std::make_unique<Conv2DConverter>()); + phase.emplace_back(std::make_unique<DepthwiseConv2DConverter>()); // TODO loco::DepthwiseFilterEncode - phase.emplace_back(stdex::make_unique<EltwiseAddConverter>()); - phase.emplace_back(stdex::make_unique<EltwiseDivConverter>()); - phase.emplace_back(stdex::make_unique<EltwiseMaxConverter>()); - phase.emplace_back(stdex::make_unique<EltwiseMulConverter>()); - phase.emplace_back(stdex::make_unique<EltwiseSqrtConverter>()); - phase.emplace_back(stdex::make_unique<EltwiseSubConverter>()); - phase.emplace_back(stdex::make_unique<FeatureBiasAddConverter>()); + phase.emplace_back(std::make_unique<EltwiseAddConverter>()); + phase.emplace_back(std::make_unique<EltwiseDivConverter>()); + phase.emplace_back(std::make_unique<EltwiseMaxConverter>()); + phase.emplace_back(std::make_unique<EltwiseMulConverter>()); + phase.emplace_back(std::make_unique<EltwiseSqrtConverter>()); + phase.emplace_back(std::make_unique<EltwiseSubConverter>()); + phase.emplace_back(std::make_unique<FeatureBiasAddConverter>()); // TODO loco::FixedReshape - phase.emplace_back(stdex::make_unique<MatMulConverter>()); - phase.emplace_back(stdex::make_unique<MaxPool2DConverter>()); - phase.emplace_back(stdex::make_unique<ReluConverter>()); - phase.emplace_back(stdex::make_unique<Relu6Converter>()); + phase.emplace_back(std::make_unique<MatMulConverter>()); + phase.emplace_back(std::make_unique<MaxPool2DConverter>()); + phase.emplace_back(std::make_unique<ReluConverter>()); + phase.emplace_back(std::make_unique<Relu6Converter>()); // TODO loco::Tanh - phase.emplace_back(stdex::make_unique<TensorConcatConverter>()); + phase.emplace_back(std::make_unique<TensorConcatConverter>()); // TODO loco::TensorBiasAdd - phase.emplace_back(stdex::make_unique<TensorBroadcastConverter>()); - phase.emplace_back(stdex::make_unique<TensorReduceConverter>()); + phase.emplace_back(std::make_unique<TensorBroadcastConverter>()); + phase.emplace_back(std::make_unique<TensorReduceConverter>()); // TODO loco::TensorSoftmax - phase.emplace_back(stdex::make_unique<TensorTransposeConverter>()); - phase.emplace_back(stdex::make_unique<TransposedConv2DConverter>()); + phase.emplace_back(std::make_unique<TensorTransposeConverter>()); + phase.emplace_back(std::make_unique<TransposedConv2DConverter>()); // Add optimization below - phase.emplace_back(stdex::make_unique<logo::SimplifyDomainConversionPass>()); - phase.emplace_back(stdex::make_unique<logo::RemoveForwardNodePass>()); - phase.emplace_back(stdex::make_unique<logo::RemoveDeadNodePass>()); + phase.emplace_back(std::make_unique<logo::SimplifyDomainConversionPass>()); + phase.emplace_back(std::make_unique<logo::RemoveForwardNodePass>()); + phase.emplace_back(std::make_unique<logo::RemoveDeadNodePass>()); } logo::PhaseRunner<logo::PhaseStrategy::Restart> phase_runner{graph}; diff --git a/compiler/exo/src/Dialect/IR/CircleNodes.h b/compiler/exo/src/Dialect/IR/CircleNodes.h index 7be093103..c93bd1ab0 100644 --- a/compiler/exo/src/Dialect/IR/CircleNodes.h +++ b/compiler/exo/src/Dialect/IR/CircleNodes.h @@ -53,8 +53,8 @@ private: * @brief INSTANCE_NORM in circle */ class CircleInstanceNorm final - : public FixedArityNode<3, CircleNodeImpl<CircleOpcode::INSTANCE_NORM>>, - public CircleNodeMixin<CircleNodeTrait::FusedActFunc> + : public FixedArityNode<3, CircleNodeImpl<CircleOpcode::INSTANCE_NORM>>, + public CircleNodeMixin<CircleNodeTrait::FusedActFunc> { public: /// @note Currently only support FLOAT32 as input node diff --git a/compiler/exo/src/Dialect/IR/TFLNodes.h b/compiler/exo/src/Dialect/IR/TFLNodes.h index 41a11e7c0..1642eb1f4 100644 --- a/compiler/exo/src/Dialect/IR/TFLNodes.h +++ b/compiler/exo/src/Dialect/IR/TFLNodes.h @@ -129,7 +129,9 @@ class TFLAveragePool2D final : public FixedArityNode<1, TFLNodeImpl<TFLOpcode::A public TFLNodeMixin<TFLNodeTrait::FusedActFunc> { public: - TFLAveragePool2D() : _padding(Padding::UNDEFINED) { /* empty */} + TFLAveragePool2D() : _padding(Padding::UNDEFINED) + { /* empty */ + } public: loco::Node *value(void) const { return at(0)->node(); } @@ -240,9 +242,9 @@ private: * @brief DEPTHWISE_CONV_2D in TensorFlow Lite */ class TFLDepthwiseConv2D final - : public FixedArityNode<3, TFLNodeImpl<TFLOpcode::DEPTHWISE_CONV_2D>>, - public TFLNodeMixin<TFLNodeTrait::FusedActFunc>, - public TFLNodeMixin<TFLNodeTrait::Bias> + : public FixedArityNode<3, TFLNodeImpl<TFLOpcode::DEPTHWISE_CONV_2D>>, + public TFLNodeMixin<TFLNodeTrait::FusedActFunc>, + public TFLNodeMixin<TFLNodeTrait::Bias> { public: loco::Node *input(void) const { return at(0)->node(); } @@ -325,7 +327,9 @@ class TFLMaxPool2D final : public FixedArityNode<1, TFLNodeImpl<TFLOpcode::MAX_P public TFLNodeMixin<TFLNodeTrait::FusedActFunc> { public: - TFLMaxPool2D() : _padding(Padding::UNDEFINED) { /* empty */} + TFLMaxPool2D() : _padding(Padding::UNDEFINED) + { /* empty */ + } public: loco::Node *value(void) const { return at(0)->node(); } @@ -463,7 +467,7 @@ public: }; class TFLSquaredDifference final - : public FixedArityNode<2, TFLNodeImpl<TFLOpcode::SQUARED_DIFFERENCE>> + : public FixedArityNode<2, TFLNodeImpl<TFLOpcode::SQUARED_DIFFERENCE>> { public: TFLSquaredDifference() = default; diff --git a/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.cpp b/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.cpp index f4bb10364..26cc561e1 100644 --- a/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.cpp +++ b/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.cpp @@ -116,7 +116,7 @@ private: }; /** - * @breif Expand shape x and y to same rank by align right and filling with 1 + * @brief Expand shape x and y to same rank by align right and filling with 1 */ void expand_rank(loco::TensorShape &x, loco::TensorShape &y) { @@ -136,7 +136,7 @@ void expand_rank(loco::TensorShape &x, loco::TensorShape &y) } /** - * @breif Returns shape of expanded dimension of input x and y having same rank + * @brief Returns shape of expanded dimension of input x and y having same rank */ loco::TensorShape expand_dimension(const loco::TensorShape &x, const loco::TensorShape &y) { diff --git a/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.test.cpp b/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.test.cpp index b68728b47..5a7e71dcf 100644 --- a/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.test.cpp +++ b/compiler/exo/src/Dialect/Service/TFLShapeInferenceRule.test.cpp @@ -26,8 +26,6 @@ #include <loco/Service/CanonicalShapeInferenceRule.h> #include <loco/Service/MultiDialectShapeInferenceRule.h> -#include <stdex/Memory.h> - #include <gtest/gtest.h> TEST(TFLShapeInferenceRuleTest, minimal_with_TFLRelu) @@ -53,7 +51,7 @@ TEST(TFLShapeInferenceRuleTest, minimal_with_TFLRelu) loco::MultiDialectShapeInferenceRule rules; rules.bind(loco::CanonicalDialect::get(), &canonical_rule) - .bind(locoex::TFLDialect::get(), &tfl_rule); + .bind(locoex::TFLDialect::get(), &tfl_rule); loco::apply(&rules).to(graph.g.get()); @@ -98,7 +96,7 @@ TEST(TFLShapeInferenceRuleTest, avgpool2d_valid) loco::MultiDialectShapeInferenceRule rules; rules.bind(loco::CanonicalDialect::get(), &canonical_rule) - .bind(locoex::TFLDialect::get(), &tfl_rule); + .bind(locoex::TFLDialect::get(), &tfl_rule); loco::apply(&rules).to(graph.g.get()); @@ -145,7 +143,7 @@ TEST(TFLShapeInferenceRuleTest, avgpool2d_same) loco::MultiDialectShapeInferenceRule rules; rules.bind(loco::CanonicalDialect::get(), &canonical_rule) - .bind(locoex::TFLDialect::get(), &tfl_rule); + .bind(locoex::TFLDialect::get(), &tfl_rule); loco::apply(&rules).to(graph.g.get()); diff --git a/compiler/exo/src/Dialect/Service/TFLTypeInferenceRule.test.cpp b/compiler/exo/src/Dialect/Service/TFLTypeInferenceRule.test.cpp index 9326e5e58..df7aee49c 100644 --- a/compiler/exo/src/Dialect/Service/TFLTypeInferenceRule.test.cpp +++ b/compiler/exo/src/Dialect/Service/TFLTypeInferenceRule.test.cpp @@ -24,8 +24,6 @@ #include <loco/IR/CanonicalDialect.h> #include <loco/Service/TypeInference.h> -#include <stdex/Memory.h> - #include <gtest/gtest.h> TEST(TFLTypeInferenceRuleTest, minimal_with_TFLRelu) diff --git a/compiler/exo/src/ExoFormattedGraph.h b/compiler/exo/src/ExoFormattedGraph.h index 714e483b5..ec4173329 100644 --- a/compiler/exo/src/ExoFormattedGraph.h +++ b/compiler/exo/src/ExoFormattedGraph.h @@ -19,7 +19,7 @@ #include <locop/FormattedGraph.h> -#include <stdex/Memory.h> +#include <memory> namespace exo { @@ -47,7 +47,7 @@ public: public: std::unique_ptr<locop::NodeSummaryBuilder> create(const locop::SymbolTable *tlb) const final { - return stdex::make_unique<NodeSummaryBuilder>(tlb); + return std::make_unique<NodeSummaryBuilder>(tlb); } }; diff --git a/compiler/exo/src/ExoOptimize.cpp b/compiler/exo/src/ExoOptimize.cpp index d7278e900..752693f38 100644 --- a/compiler/exo/src/ExoOptimize.cpp +++ b/compiler/exo/src/ExoOptimize.cpp @@ -22,7 +22,7 @@ #include <logo/Phase.h> -#include <stdex/Memory.h> +#include <memory> namespace exo { @@ -32,36 +32,36 @@ void optimize(loco::Graph *g) logo::Phase phase; { // prepare type and shape before optimization - phase.emplace_back(stdex::make_unique<TypeInferencePass>()); - phase.emplace_back(stdex::make_unique<ShapeInferencePass>()); + phase.emplace_back(std::make_unique<TypeInferencePass>()); + phase.emplace_back(std::make_unique<ShapeInferencePass>()); - phase.emplace_back(stdex::make_unique<FoldReshapeOfConstPass>()); - phase.emplace_back(stdex::make_unique<FoldTransposeOfConstPass>()); + phase.emplace_back(std::make_unique<FoldReshapeOfConstPass>()); + phase.emplace_back(std::make_unique<FoldTransposeOfConstPass>()); if (get<Knob::UseFuseBiasAddPass>()) { - phase.emplace_back(stdex::make_unique<FuseBiasAddPass>()); + phase.emplace_back(std::make_unique<FuseBiasAddPass>()); } if (get<Knob::UseFuseInstanceNormPass>()) { - phase.emplace_back(stdex::make_unique<FuseInstanceNormPass>()); + phase.emplace_back(std::make_unique<FuseInstanceNormPass>()); } if (get<Knob::UseFuseReluPass>()) { - phase.emplace_back(stdex::make_unique<FuseReluPass>()); + phase.emplace_back(std::make_unique<FuseReluPass>()); } - phase.emplace_back(stdex::make_unique<FuseRsqrtPass>()); + phase.emplace_back(std::make_unique<FuseRsqrtPass>()); if (get<Knob::UseFuseSquaredDifferencePass>()) { - phase.emplace_back(stdex::make_unique<FuseSquaredDifferencePass>()); + phase.emplace_back(std::make_unique<FuseSquaredDifferencePass>()); } - phase.emplace_back(stdex::make_unique<MergeConcatNodesPass>()); + phase.emplace_back(std::make_unique<MergeConcatNodesPass>()); - phase.emplace_back(stdex::make_unique<logo::RemoveDeadNodePass>()); + phase.emplace_back(std::make_unique<logo::RemoveDeadNodePass>()); } logo::PhaseRunner<logo::PhaseStrategy::Restart> phase_runner{g}; diff --git a/compiler/exo/src/GraphBlock.cpp b/compiler/exo/src/GraphBlock.cpp index 0a45ce8ad..b26f2e8b6 100644 --- a/compiler/exo/src/GraphBlock.cpp +++ b/compiler/exo/src/GraphBlock.cpp @@ -19,7 +19,7 @@ #include "Check.h" #include <loco.h> -#include <stdex/Memory.h> +#include <memory> namespace { @@ -114,7 +114,7 @@ template <FeatureLayout T> loco::FeatureEncode *make_feature_encode(loco::Node * EXO_ASSERT(input_for_encode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_encode->graph(); - auto encoder = stdex::make_unique<loco::PermutingEncoder<loco::Domain::Feature>>(); + auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Feature>>(); encoder->perm(perm<T>()); @@ -130,7 +130,7 @@ template <FeatureLayout T> loco::FeatureDecode *make_feature_decode(loco::Node * EXO_ASSERT(input_for_decode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_decode->graph(); - auto decoder = stdex::make_unique<loco::PermutingDecoder<loco::Domain::Feature>>(); + auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Feature>>(); decoder->perm(perm<T>()); @@ -146,7 +146,7 @@ template <FilterLayout T> loco::FilterEncode *make_filter_encode(loco::Node *inp EXO_ASSERT(input_for_encode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_encode->graph(); - auto encoder = stdex::make_unique<loco::PermutingEncoder<loco::Domain::Filter>>(); + auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Filter>>(); encoder->perm(perm<T>()); @@ -162,7 +162,7 @@ template <FilterLayout T> loco::FilterDecode *make_filter_decode(loco::Node *inp EXO_ASSERT(input_for_decode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_decode->graph(); - auto decoder = stdex::make_unique<loco::PermutingDecoder<loco::Domain::Filter>>(); + auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Filter>>(); decoder->perm(perm<T>()); @@ -179,7 +179,7 @@ loco::DepthwiseFilterDecode *make_dw_filter_decode(loco::Node *input_for_decode) EXO_ASSERT(input_for_decode != nullptr, "filter should not be nullptr"); loco::Graph *g = input_for_decode->graph(); - auto decoder = stdex::make_unique<loco::PermutingDecoder<loco::Domain::DepthwiseFilter>>(); + auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::DepthwiseFilter>>(); decoder->perm(perm<T>()); @@ -195,7 +195,7 @@ template <MatrixLayout T> loco::MatrixEncode *make_matrix_encode(loco::Node *inp EXO_ASSERT(input_for_encode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_encode->graph(); - auto encoder = stdex::make_unique<loco::PermutingEncoder<loco::Domain::Matrix>>(); + auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Matrix>>(); encoder->perm(perm<T>()); @@ -211,7 +211,7 @@ template <MatrixLayout T> loco::MatrixDecode *make_matrix_decode(loco::Node *inp EXO_ASSERT(input_for_decode != nullptr, "input should not be nullptr"); loco::Graph *g = input_for_decode->graph(); - auto decoder = stdex::make_unique<loco::PermutingDecoder<loco::Domain::Matrix>>(); + auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Matrix>>(); decoder->perm(perm<T>()); diff --git a/compiler/exo/src/GraphBlock.h b/compiler/exo/src/GraphBlock.h index b771c821b..96e4b0831 100644 --- a/compiler/exo/src/GraphBlock.h +++ b/compiler/exo/src/GraphBlock.h @@ -72,7 +72,7 @@ template <MatrixLayout T> loco::MatrixEncode *make_matrix_encode(loco::Node *inp /// @brief Create a loco::MatrixDecode of given layout template <MatrixLayout T> loco::MatrixDecode *make_matrix_decode(loco::Node *input_for_decode); -} // exo +} // namespace exo // // DomainConverter diff --git a/compiler/exo/src/Log.cpp b/compiler/exo/src/Log.cpp index aa762968b..cbe9ecb73 100644 --- a/compiler/exo/src/Log.cpp +++ b/compiler/exo/src/Log.cpp @@ -17,7 +17,6 @@ #include "Log.h" #include <hermes/ConsoleReporter.h> -#include <stdex/Memory.h> #include <cstdlib> #include <iostream> diff --git a/compiler/exo/src/LogHelper.cpp b/compiler/exo/src/LogHelper.cpp index 7520b7ec8..153356632 100644 --- a/compiler/exo/src/LogHelper.cpp +++ b/compiler/exo/src/LogHelper.cpp @@ -72,7 +72,7 @@ namespace exo FormattedGraph fmt(loco::Graph *g) { - auto node_summary_builder = stdex::make_unique<NodeSummaryBuilderFactory>(); + auto node_summary_builder = std::make_unique<NodeSummaryBuilderFactory>(); return std::move(locop::fmt<locop::LinearV1>(g).with(std::move(node_summary_builder))); } diff --git a/compiler/exo/src/LoggingContext.cpp b/compiler/exo/src/LoggingContext.cpp index 1c14d97b9..120a50e7b 100644 --- a/compiler/exo/src/LoggingContext.cpp +++ b/compiler/exo/src/LoggingContext.cpp @@ -18,7 +18,8 @@ #include "Log.h" // To use LoggerConfig #include <hermes/ConsoleReporter.h> -#include <stdex/Memory.h> + +#include <memory> namespace exo { @@ -30,11 +31,11 @@ hermes::Context *LoggingContext::get(void) if (ctx == nullptr) { ctx = new hermes::Context; - ctx->sinks()->append(stdex::make_unique<hermes::ConsoleReporter>()); - ctx->config(stdex::make_unique<LoggerConfig>()); + ctx->sinks()->append(std::make_unique<hermes::ConsoleReporter>()); + ctx->config(std::make_unique<LoggerConfig>()); } return ctx; } -} // namespac exo +} // namespace exo diff --git a/compiler/exo/src/Pass/FoldTransposeOfConstPass.cpp b/compiler/exo/src/Pass/FoldTransposeOfConstPass.cpp index 005c42944..66c99121e 100644 --- a/compiler/exo/src/Pass/FoldTransposeOfConstPass.cpp +++ b/compiler/exo/src/Pass/FoldTransposeOfConstPass.cpp @@ -124,7 +124,7 @@ void fold_transpose_of_const(locoex::TFLTranspose *transpose) index_orig.at(perm->at<S32>(axis)) = index_new.at(axis); const_new->at<FLOAT32>(l.offset(shape_new, index_new)) = - const_orig->at<FLOAT32>(l.offset(shape_orig, index_orig)); + const_orig->at<FLOAT32>(l.offset(shape_orig, index_orig)); } // replace diff --git a/compiler/exo/src/Pass/FuseBiasAddPass.cpp b/compiler/exo/src/Pass/FuseBiasAddPass.cpp index 6338dff5d..0e797dc80 100644 --- a/compiler/exo/src/Pass/FuseBiasAddPass.cpp +++ b/compiler/exo/src/Pass/FuseBiasAddPass.cpp @@ -136,7 +136,7 @@ public: Fuser(LatterT *latter) { static_assert(std::is_same<LatterT, locoex::TFLAdd>::value || - std::is_same<LatterT, locoex::TFLSub>::value, + std::is_same<LatterT, locoex::TFLSub>::value, "wrong template type"); _latter = latter; @@ -185,7 +185,7 @@ template <class LatterT> locoex::TFLConst *Fuser<LatterT>::create_fused_bias_con for (uint32_t x = 0; x < bias->dim(0).value(); x++) new_bias->at<loco::DataType::FLOAT32>(x) = calc<LatterT>( - bias->at<loco::DataType::FLOAT32>(x), _const_node->at<loco::DataType::FLOAT32>(x)); + bias->at<loco::DataType::FLOAT32>(x), _const_node->at<loco::DataType::FLOAT32>(x)); } return new_bias; @@ -252,14 +252,14 @@ struct Collector final : public locoex::TFLNodeMutableVisitor<void> void setCandidate(FormerT *former, LatterT *latter, locoex::TFLConst *const_node) { static_assert(std::is_same<LatterT, locoex::TFLAdd>::value || - std::is_same<LatterT, locoex::TFLSub>::value, + std::is_same<LatterT, locoex::TFLSub>::value, "wrong template type"); if (!check_act_func(former)) return; auto depth = - loco::shape_get(as_loco_node(former)).template as<loco::TensorShape>().dim(3).value(); + loco::shape_get(as_loco_node(former)).template as<loco::TensorShape>().dim(3).value(); auto const_shape = loco::shape_get(const_node).template as<loco::TensorShape>(); if (const_shape.rank() == 1 and const_shape.dim(0) == depth) diff --git a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp index 04d4a62cd..40aa9144f 100644 --- a/compiler/exo/src/Pass/FuseInstanceNormPass.cpp +++ b/compiler/exo/src/Pass/FuseInstanceNormPass.cpp @@ -291,7 +291,7 @@ bool InstanceNormPattern::matched() CHECK_OR_FALSE(add_as_variance); CHECK_OR_FALSE( - fill(&mean_as_variance, &const_as_epsilon).with_commutative_args_of(add_as_variance)); + fill(&mean_as_variance, &const_as_epsilon).with_commutative_args_of(add_as_variance)); CHECK_OR_FALSE(const_as_epsilon->dtype() == loco::DataType::FLOAT32); // TODO Support regarding broadcast @@ -317,7 +317,7 @@ bool InstanceNormPattern::matched() locoex::TFLMul *mul_gamma_should_be = nullptr; locoex::TFLMean *mean_of_ifm_should_be = nullptr; CHECK_OR_FALSE(fill(&mul_gamma_should_be, &mean_of_ifm_should_be) - .with_commutative_args_of(mul_as_scaled_mean)); + .with_commutative_args_of(mul_as_scaled_mean)); CHECK_OR_FALSE(mul_gamma == mul_gamma_should_be); CHECK_OR_FALSE(mean_of_ifm == mean_of_ifm_should_be); #undef CHECK_OR_FALSE diff --git a/compiler/exo/src/Pass/FuseReluPass.test.cpp b/compiler/exo/src/Pass/FuseReluPass.test.cpp index 6f83d4dd0..fd6f88d9c 100644 --- a/compiler/exo/src/Pass/FuseReluPass.test.cpp +++ b/compiler/exo/src/Pass/FuseReluPass.test.cpp @@ -73,8 +73,8 @@ template <class FusedTFLType, locoex::FusedActFunc FusedActFunc> void test() { static_assert((std::is_same<FusedTFLType, locoex::TFLRelu>::value && FusedActFunc == locoex::FusedActFunc::RELU) || - (std::is_same<FusedTFLType, locoex::TFLRelu6>::value && - FusedActFunc == locoex::FusedActFunc::RELU6), + (std::is_same<FusedTFLType, locoex::TFLRelu6>::value && + FusedActFunc == locoex::FusedActFunc::RELU6), "wrong template type"); exo::test::TestGraph g; diff --git a/compiler/exo/src/Pass/MergeConcatNodesPass.cpp b/compiler/exo/src/Pass/MergeConcatNodesPass.cpp index 8945fcfce..5885332a6 100644 --- a/compiler/exo/src/Pass/MergeConcatNodesPass.cpp +++ b/compiler/exo/src/Pass/MergeConcatNodesPass.cpp @@ -39,8 +39,8 @@ bool canMerge(locoex::TFLConcatenation *node1, locoex::TFLConcatenation *node2) case locoex::FusedActFunc::RELU6: return true; - // case locoex::FusedActFunc::TANH: - // return false; + // case locoex::FusedActFunc::TANH: + // return false; default: INTERNAL_EXN_V("Unknown FusedActFunc", oops::to_uint32(node1->fusedActivationFunction())); diff --git a/compiler/exo/src/Pass/ShapeInferencePass.cpp b/compiler/exo/src/Pass/ShapeInferencePass.cpp index bc60f91c4..367d7da91 100644 --- a/compiler/exo/src/Pass/ShapeInferencePass.cpp +++ b/compiler/exo/src/Pass/ShapeInferencePass.cpp @@ -49,9 +49,9 @@ bool ShapeInferencePass::run(loco::Graph *g) loco::MultiDialectShapeInferenceRule rules; rules.bind(loco::CanonicalDialect::get(), &canonical_rule) - .bind(locoex::TFLDialect::get(), &tfl_rule) - .bind(locoex::CircleDialect::get(), &circle_rule) - .bind(locoex::COpDialect::get(), &cop_rule); + .bind(locoex::TFLDialect::get(), &tfl_rule) + .bind(locoex::CircleDialect::get(), &circle_rule) + .bind(locoex::COpDialect::get(), &cop_rule); return loco::apply(&rules).to(g); } diff --git a/compiler/exo/src/Pass/TypeInferencePass.cpp b/compiler/exo/src/Pass/TypeInferencePass.cpp index 31d4f13b6..52a9d0c33 100644 --- a/compiler/exo/src/Pass/TypeInferencePass.cpp +++ b/compiler/exo/src/Pass/TypeInferencePass.cpp @@ -47,9 +47,9 @@ bool TypeInferencePass::run(loco::Graph *g) loco::MultiDialectTypeInferenceRule rules; rules.bind(loco::CanonicalDialect::get(), &canonical_rule) - .bind(locoex::TFLDialect::get(), &tfl_rule) - .bind(locoex::CircleDialect::get(), &circle_rule) - .bind(locoex::COpDialect::get(), &cop_rule); + .bind(locoex::TFLDialect::get(), &tfl_rule) + .bind(locoex::CircleDialect::get(), &circle_rule) + .bind(locoex::COpDialect::get(), &cop_rule); return loco::apply(&rules).to(g); } diff --git a/compiler/exo/src/ProgressReporter.h b/compiler/exo/src/ProgressReporter.h index b0f420df9..83f327309 100644 --- a/compiler/exo/src/ProgressReporter.h +++ b/compiler/exo/src/ProgressReporter.h @@ -28,7 +28,7 @@ class ProgressReporter : public logo::PhaseEventListener { public: ProgressReporter(loco::Graph *graph, logo::PhaseStrategy strategy) - : _graph{graph}, _strategy{strategy} + : _graph{graph}, _strategy{strategy} { // DO NOTHING } diff --git a/compiler/exo/src/TFLite/TFLExporter.cpp b/compiler/exo/src/TFLite/TFLExporter.cpp index cf002b3e1..71131b725 100644 --- a/compiler/exo/src/TFLite/TFLExporter.cpp +++ b/compiler/exo/src/TFLite/TFLExporter.cpp @@ -18,16 +18,15 @@ #include "TFLExporterImpl.h" -#include <stdex/Memory.h> - #include <oops/InternalExn.h> +#include <memory> #include <fstream> namespace exo { -TFLExporter::TFLExporter(loco::Graph *graph) : _impl(stdex::make_unique<Impl>(graph)) +TFLExporter::TFLExporter(loco::Graph *graph) : _impl(std::make_unique<Impl>(graph)) { // NOTHING TO DO } diff --git a/compiler/exo/src/TFLite/TFLExporterImpl.cpp b/compiler/exo/src/TFLite/TFLExporterImpl.cpp index 07adbfb9d..1f6d1bd59 100644 --- a/compiler/exo/src/TFLite/TFLExporterImpl.cpp +++ b/compiler/exo/src/TFLite/TFLExporterImpl.cpp @@ -88,7 +88,7 @@ encodeOperatorCodes(FlatBufferBuilder &builder, std::unordered_map<OpCode, uint3 INTERNAL_EXN("Cannot find code for custom op"); operator_codes_vec[idx] = - CreateOperatorCode(builder, it.first.opcode, builder.CreateString(custom_code->second)); + CreateOperatorCode(builder, it.first.opcode, builder.CreateString(custom_code->second)); } } return builder.CreateVector(operator_codes_vec); @@ -146,7 +146,7 @@ void TFLExporter::Impl::exportGraph(loco::Graph *graph) // encode operator codes auto operator_codes = - encodeOperatorCodes(_builder, gd._operator_codes, gd._custom_operator_codes); + encodeOperatorCodes(_builder, gd._operator_codes, gd._custom_operator_codes); // Subgraphs Offset<SubGraph> subgraph = exportSubgraph(gd); diff --git a/compiler/exo/src/TFLite/TFLExporterImpl.test.cpp b/compiler/exo/src/TFLite/TFLExporterImpl.test.cpp index 866ede6a2..c337b38d3 100644 --- a/compiler/exo/src/TFLite/TFLExporterImpl.test.cpp +++ b/compiler/exo/src/TFLite/TFLExporterImpl.test.cpp @@ -23,7 +23,8 @@ #include "Knob.h" #include <loco/IR/PermutingCodec.h> -#include <stdex/Memory.h> + +#include <memory> #include <gtest/gtest.h> @@ -56,7 +57,7 @@ template <> loco::FeatureEncode *TFLExporterImplTests::make_node(void) { loco::FeatureEncode *encode_layer = graph()->nodes()->create<loco::FeatureEncode>(); - auto encoder = stdex::make_unique<loco::PermutingEncoder<loco::Domain::Feature>>(); + auto encoder = std::make_unique<loco::PermutingEncoder<loco::Domain::Feature>>(); (*encoder->perm())[loco::FeatureAxis::Count] = 0; (*encoder->perm())[loco::FeatureAxis::Depth] = 1; (*encoder->perm())[loco::FeatureAxis::Height] = 2; @@ -70,7 +71,7 @@ template <> loco::FeatureDecode *TFLExporterImplTests::make_node(void) { loco::FeatureDecode *decode_layer = graph()->nodes()->create<loco::FeatureDecode>(); - auto decoder = stdex::make_unique<loco::PermutingDecoder<loco::Domain::Feature>>(); + auto decoder = std::make_unique<loco::PermutingDecoder<loco::Domain::Feature>>(); (*decoder->perm())[loco::FeatureAxis::Count] = 0; (*decoder->perm())[loco::FeatureAxis::Depth] = 1; (*decoder->perm())[loco::FeatureAxis::Height] = 2; @@ -227,7 +228,7 @@ TEST(TFLExporterImplTest, Transpose_simple) auto bufs = (model->buffers()); auto *perm_buf = - reinterpret_cast<const int32_t *>(bufs->Get(perm_tensor->buffer())->data()->data()); + reinterpret_cast<const int32_t *>(bufs->Get(perm_tensor->buffer())->data()->data()); ASSERT_EQ(1, perm_buf[0]); ASSERT_EQ(2, perm_buf[1]); @@ -285,7 +286,7 @@ TEST(TFLExporterImplTest, Transpose_from_FilterEncode_FilterDecode) auto bufs = (model->buffers()); auto *perm_buf = - reinterpret_cast<const int32_t *>(bufs->Get(perm_tensor->buffer())->data()->data()); + reinterpret_cast<const int32_t *>(bufs->Get(perm_tensor->buffer())->data()->data()); ASSERT_EQ(3, perm_buf[0]); ASSERT_EQ(0, perm_buf[1]); ASSERT_EQ(1, perm_buf[2]); diff --git a/compiler/exo/src/TFLite/TFLExporterUtils.cpp b/compiler/exo/src/TFLite/TFLExporterUtils.cpp index d35afc9aa..daec03c40 100644 --- a/compiler/exo/src/TFLite/TFLExporterUtils.cpp +++ b/compiler/exo/src/TFLite/TFLExporterUtils.cpp @@ -78,13 +78,13 @@ tflite::Padding getOpPadding(const loco::Padding2D *pad, const loco::Stride<2> * // // NOTE input and output 'feature' map are shape of NHWC bool same_padding_criterion_1 = - (static_cast<uint32_t>(ofm._dims[1]) == (ifm._dims[1] - 1) / stride->vertical() + 1) && - (static_cast<uint32_t>(ofm._dims[2]) == (ifm._dims[2] - 1) / stride->horizontal() + 1); + (static_cast<uint32_t>(ofm._dims[1]) == (ifm._dims[1] - 1) / stride->vertical() + 1) && + (static_cast<uint32_t>(ofm._dims[2]) == (ifm._dims[2] - 1) / stride->horizontal() + 1); // For same padding, rear padding is same or bigger than front padding by at most 1 bool same_padding_criterion_2 = - (pad->top() <= pad->bottom()) && (pad->bottom() <= pad->top() + 1) && - (pad->left() <= pad->right()) && (pad->right() <= pad->left() + 1); + (pad->top() <= pad->bottom()) && (pad->bottom() <= pad->top() + 1) && + (pad->left() <= pad->right()) && (pad->right() <= pad->left() + 1); if (same_padding_criterion_1 && same_padding_criterion_2) return tflite::Padding_SAME; @@ -120,8 +120,7 @@ void registerGraphIOName(loco::Graph *graph, SerializedModelData &gd) } } -#include <stdex/Memory.h> - +#include <memory> #include <cassert> namespace @@ -147,7 +146,7 @@ private: void set_tensor_index(loco::Node *node, const TFLTensorIndex &tensor_id) { assert(node->annot<TFLTensorIndexAnnotation>() == nullptr); - node->annot(stdex::make_unique<TFLTensorIndexAnnotation>(tensor_id)); + node->annot(std::make_unique<TFLTensorIndexAnnotation>(tensor_id)); } TFLTensorIndex get_tensor_index(loco::Node *node) diff --git a/compiler/exo/src/TFLite/TFLExporterUtils.h b/compiler/exo/src/TFLite/TFLExporterUtils.h index dbd7a52fb..f2fe6075e 100644 --- a/compiler/exo/src/TFLite/TFLExporterUtils.h +++ b/compiler/exo/src/TFLite/TFLExporterUtils.h @@ -65,7 +65,7 @@ namespace tflite_detail { /** - * @breif Record the information of T/F Lite SubGraph and its mapping to loco + * @brief Record the information of T/F Lite SubGraph and its mapping to loco */ struct SubGraphContext { diff --git a/compiler/exo/src/TFLite/TFLOperationExporter.cpp b/compiler/exo/src/TFLite/TFLOperationExporter.cpp index 79b5b6287..b7a0ffea8 100644 --- a/compiler/exo/src/TFLite/TFLOperationExporter.cpp +++ b/compiler/exo/src/TFLite/TFLOperationExporter.cpp @@ -81,13 +81,19 @@ public: void visit(loco::ReLU *) final; void visit(loco::ReLU6 *) final; void visit(loco::Tanh *) final; - void visit(loco::Push *) final { /* DO NOTHING */} - void visit(loco::Pull *) final { /* DO NOTHING */} + void visit(loco::Push *) final + { /* DO NOTHING */ + } + void visit(loco::Pull *) final + { /* DO NOTHING */ + } void visit(loco::FeatureEncode *) final; void visit(loco::FeatureDecode *) final; void visit(loco::FilterEncode *) final; void visit(loco::DepthwiseFilterEncode *) final; - void visit(loco::ConstGen *) final { /* skip, everything is done in exportOpDefinedTensors */} + void visit(loco::ConstGen *) final + { /* skip, everything is done in exportOpDefinedTensors */ + } void visit(loco::MaxPool2D *) final; void visit(loco::AvgPool2D *) final; void visit(loco::Conv2D *) final; @@ -227,7 +233,7 @@ void OperationExporter::visit(locoex::TFLFullyConnected *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); auto options = - CreateFullyConnectedOptions(builder, to_tflite_actfunc(node->fusedActivationFunction())); + CreateFullyConnectedOptions(builder, to_tflite_actfunc(node->fusedActivationFunction())); // Make FULLY_CONNECTED operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -367,8 +373,8 @@ void OperationExporter::visit(locoex::TFLTranspose *node) auto options = CreateTransposeOptions(builder); auto op_offset = - CreateOperator(builder, op_idx, inputs, outputs, - tflite::BuiltinOptions::BuiltinOptions_TransposeOptions, options.Union()); + CreateOperator(builder, op_idx, inputs, outputs, + tflite::BuiltinOptions::BuiltinOptions_TransposeOptions, options.Union()); gd._operators.push_back(op_offset); } @@ -385,7 +391,7 @@ void OperationExporter::visit(locoex::TFLTransposeConv *node) auto outputs = builder.CreateVector(outputs_vec); tflite::Padding padding = getOpPadding(node->padding()); auto options = - CreateTransposeConvOptions(builder, padding, node->stride()->w(), node->stride()->h()); + CreateTransposeConvOptions(builder, padding, node->stride()->w(), node->stride()->h()); // Make TRANSPOSE_CONV operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -397,7 +403,7 @@ template <class TFLPool2D> void OperationExporter::export_pool_2d(TFLPool2D *node, tflite::BuiltinOperator builtin_op) { EXO_ASSERT(builtin_op == tflite::BuiltinOperator_MAX_POOL_2D || - builtin_op == tflite::BuiltinOperator_AVERAGE_POOL_2D, + builtin_op == tflite::BuiltinOperator_AVERAGE_POOL_2D, "should be maxpool or avgpool"); EXO_ASSERT(node->padding() != locoex::Padding::UNDEFINED, "Padding is not set"); @@ -458,10 +464,10 @@ void OperationExporter::visit(loco::MaxPool2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); tflite::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreatePool2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), node->window()->horizontal(), - node->window()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreatePool2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical(), + node->window()->horizontal(), node->window()->vertical()); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, tflite::BuiltinOptions_Pool2DOptions, options.Union()); gd._operators.push_back(op_offset); @@ -478,10 +484,10 @@ void OperationExporter::visit(loco::AvgPool2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); tflite::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreatePool2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), node->window()->horizontal(), - node->window()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreatePool2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical(), + node->window()->horizontal(), node->window()->vertical()); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, tflite::BuiltinOptions_Pool2DOptions, options.Union()); gd._operators.push_back(op_offset); @@ -504,7 +510,7 @@ void OperationExporter::visit(loco::Conv2D *node) std::vector<float> bias_vec_data(bias_vec_size); // initialized as zero vector auto bias_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); auto bias_buffer_offset = CreateBuffer(builder, bias_vec_offset); @@ -516,7 +522,7 @@ void OperationExporter::visit(loco::Conv2D *node) auto name_offset = builder.CreateString("t_" + std::to_string(bias_tensor_id)); auto bias_tensor_offset = - CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); + CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); gd._tensors.push_back(bias_tensor_offset); // Make input, output and options for operator @@ -526,9 +532,9 @@ void OperationExporter::visit(loco::Conv2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); tflite::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); - auto options = CreateConv2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical()); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + auto options = + CreateConv2DOptions(builder, padding, node->stride()->horizontal(), node->stride()->vertical()); // Make CONV_2D operator auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, @@ -558,7 +564,7 @@ void OperationExporter::visit(loco::TransposedConv2D *node) } auto outshape_vec_offset = builder.CreateVector( - reinterpret_cast<uint8_t *>(outshape_vec_data.data()), raw_outshape_vec_size); + reinterpret_cast<uint8_t *>(outshape_vec_data.data()), raw_outshape_vec_size); auto outshape_buffer_offset = CreateBuffer(builder, outshape_vec_offset); @@ -607,7 +613,7 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) size_t raw_bias_vec_size = bias_vec_size * sizeof(int32_t); std::vector<float> bias_vec_data(bias_vec_size); auto bias_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(bias_vec_data.data()), raw_bias_vec_size); auto bias_buffer_offset = CreateBuffer(builder, bias_vec_offset); @@ -619,7 +625,7 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) auto name_offset = builder.CreateString("t_" + std::to_string(bias_tensor_id)); auto bias_tensor_offset = - CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); + CreateTensor(builder, bias_vec_shape_offset, TensorType_FLOAT32, bias_buffer_id, name_offset); gd._tensors.push_back(bias_tensor_offset); std::vector<int32_t> inputs_vec{get_tensor_index(node->ifm()), get_tensor_index(node->ker()), @@ -628,13 +634,13 @@ void OperationExporter::visit(loco::DepthwiseConv2D *node) auto inputs = builder.CreateVector(inputs_vec); auto outputs = builder.CreateVector(outputs_vec); tflite::Padding padding = getOpPadding( - node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); + node->pad(), node->stride(), ShapeInference::get(node->ifm()), ShapeInference::get(node)); int32_t ifm_channel_size = ShapeInference::get(node->ifm())._dims[3]; // multiplier = bias_vec_size(output_size)/ifm_channel_size auto options = - CreateDepthwiseConv2DOptions(builder, padding, node->stride()->horizontal(), - node->stride()->vertical(), bias_vec_size / ifm_channel_size); + CreateDepthwiseConv2DOptions(builder, padding, node->stride()->horizontal(), + node->stride()->vertical(), bias_vec_size / ifm_channel_size); auto op_offset = CreateOperator(builder, op_idx, inputs, outputs, tflite::BuiltinOptions_DepthwiseConv2DOptions, options.Union()); @@ -668,7 +674,7 @@ void OperationExporter::visit(loco::TensorReduce *node) size_t raw_axes_vec_size = axes_vec_size * sizeof(int32_t); auto axes_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(axes_vec.data()), raw_axes_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(axes_vec.data()), raw_axes_vec_size); auto axes_buffer_offset = CreateBuffer(builder, axes_vec_offset); @@ -680,7 +686,7 @@ void OperationExporter::visit(loco::TensorReduce *node) auto name_offset = builder.CreateString("t_" + std::to_string(axes_tensor_id)); auto axes_tensor_offset = - CreateTensor(builder, axes_vec_shape_offset, TensorType_INT32, axes_buffer_id, name_offset); + CreateTensor(builder, axes_vec_shape_offset, TensorType_INT32, axes_buffer_id, name_offset); gd._tensors.push_back(axes_tensor_offset); std::vector<int32_t> inputs_vec{get_tensor_index(node->input()), axes_tensor_id}; @@ -743,7 +749,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, constexpr size_t raw_perm_vec_size = perm_vec_size * sizeof(int32_t); auto perm_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(perm_vec_data.data()), raw_perm_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(perm_vec_data.data()), raw_perm_vec_size); auto perm_buffer_offset = CreateBuffer(builder, perm_vec_offset); @@ -755,7 +761,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, auto name_offset = builder.CreateString("t_" + std::to_string(perm_tensor_id)); auto perm_tensor_offset = - CreateTensor(builder, perm_vec_shape_offset, TensorType_INT32, perm_buffer_id, name_offset); + CreateTensor(builder, perm_vec_shape_offset, TensorType_INT32, perm_buffer_id, name_offset); gd._tensors.push_back(perm_tensor_offset); // Create permutation node @@ -769,7 +775,7 @@ void exportAsTranspose(loco::Node *node, FlatBufferBuilder &builder, constexpr auto options_type = tflite::BuiltinOptions::BuiltinOptions_TransposeOptions; auto transpose_offset = - CreateOperator(builder, op_idx, inputs, outputs, options_type, options.Union()); + CreateOperator(builder, op_idx, inputs, outputs, options_type, options.Union()); gd._operators.push_back(transpose_offset); } @@ -854,11 +860,11 @@ void exportAsReshape(loco::Node *node, FlatBufferBuilder &builder, // but also by input. auto input_shape_shape_vec_offset = - builder.CreateVector(std::vector<int32_t>{(int32_t)new_shape_vec.size()}); + builder.CreateVector(std::vector<int32_t>{(int32_t)new_shape_vec.size()}); size_t input_shape_vec_size = new_shape_vec.size() * sizeof(int32_t); auto input_shape_input_vec_offset = - builder.CreateVector(reinterpret_cast<uint8_t *>(new_shape_vec.data()), input_shape_vec_size); + builder.CreateVector(reinterpret_cast<uint8_t *>(new_shape_vec.data()), input_shape_vec_size); auto input_shape_buffer_offset = CreateBuffer(builder, input_shape_input_vec_offset); const auto input_shape_buffer_id = static_cast<uint32_t>(gd._buffers.size()); @@ -867,7 +873,7 @@ void exportAsReshape(loco::Node *node, FlatBufferBuilder &builder, auto input_shape_tensor_id = static_cast<int32_t>(gd._tensors.size()); auto name_offset = builder.CreateString("t_" + std::to_string(input_shape_tensor_id)); auto input_shape_tensor_offset = CreateTensor( - builder, input_shape_shape_vec_offset, TensorType_INT32, input_shape_buffer_id, name_offset); + builder, input_shape_shape_vec_offset, TensorType_INT32, input_shape_buffer_id, name_offset); gd._tensors.push_back(input_shape_tensor_offset); uint32_t op_idx = gd.registerBuiltinOpcode(tflite::BuiltinOperator_RESHAPE); @@ -1069,7 +1075,7 @@ void OperationExporter::visit(loco::TensorConstantPad *node) auto padding_shape_vec_ptr = builder.CreateVector(std::vector<int32_t>{padding_vec_size, 2}); // create tensor auto padding_tensor_ptr = - CreateTensor(builder, padding_shape_vec_ptr, TensorType_INT32, padding_buffer_id); + CreateTensor(builder, padding_shape_vec_ptr, TensorType_INT32, padding_buffer_id); // get tensor id const auto padding_tensor_id = static_cast<int32_t>(gd._tensors.size()); diff --git a/compiler/exo/src/TFLite/TFLTensorExporter.cpp b/compiler/exo/src/TFLite/TFLTensorExporter.cpp index 23c810ed5..2fb6f0c13 100644 --- a/compiler/exo/src/TFLite/TFLTensorExporter.cpp +++ b/compiler/exo/src/TFLite/TFLTensorExporter.cpp @@ -89,7 +89,7 @@ struct NoOpDetector final : public loco::CanonicalNodeMutableVisitor<bool> bool visit(loco::FeatureEncode *node) final { auto encoder = - loco::must_cast<loco::PermutingEncoder<loco::Domain::Feature> *>(node->encoder()); + loco::must_cast<loco::PermutingEncoder<loco::Domain::Feature> *>(node->encoder()); auto perm = encoder->perm(); return isNHWC(perm); } @@ -97,7 +97,7 @@ struct NoOpDetector final : public loco::CanonicalNodeMutableVisitor<bool> bool visit(loco::FeatureDecode *node) final { auto decoder = - loco::must_cast<loco::PermutingDecoder<loco::Domain::Feature> *>(node->decoder()); + loco::must_cast<loco::PermutingDecoder<loco::Domain::Feature> *>(node->decoder()); auto perm = decoder->perm(); return isNHWC(perm); } diff --git a/compiler/exo/src/TFLite/TFLTypeInference.cpp b/compiler/exo/src/TFLite/TFLTypeInference.cpp index 8d6bb8d8c..56817ee3b 100644 --- a/compiler/exo/src/TFLite/TFLTypeInference.cpp +++ b/compiler/exo/src/TFLite/TFLTypeInference.cpp @@ -31,8 +31,6 @@ #include <oops/InternalExn.h> -#include <stdex/Memory.h> - #include <stdexcept> #include <type_traits> diff --git a/compiler/exo/src/TFLite/TFLTypeInference.test.cpp b/compiler/exo/src/TFLite/TFLTypeInference.test.cpp index 8a3a08da9..054dad1f1 100644 --- a/compiler/exo/src/TFLite/TFLTypeInference.test.cpp +++ b/compiler/exo/src/TFLite/TFLTypeInference.test.cpp @@ -18,12 +18,9 @@ #include "Pass/TypeInferencePass.h" #include <loco/IR/PermutingCodec.h> -#include <stdex/Memory.h> #include <gtest/gtest.h> -using stdex::make_unique; - namespace { diff --git a/compiler/exo/src/TestGraph.h b/compiler/exo/src/TestGraph.h index f919cc9ae..46c2264ab 100644 --- a/compiler/exo/src/TestGraph.h +++ b/compiler/exo/src/TestGraph.h @@ -23,8 +23,6 @@ #include <loco.h> -#include <stdex/Memory.h> - #include <cassert> namespace exo @@ -284,7 +282,7 @@ public: { filterEncode = exo::make_filter_encode<exo::FilterLayout::HWIO>(pull); // from Tensorflow filterDecode = - exo::make_filter_decode<exo::FilterLayout::OHWI>(filterEncode); // to Tensorflow Lite + exo::make_filter_decode<exo::FilterLayout::OHWI>(filterEncode); // to Tensorflow Lite complete(filterDecode); } }; diff --git a/compiler/exo/src/TestHelper.h b/compiler/exo/src/TestHelper.h index 1a3de50f5..bacaa3e5e 100644 --- a/compiler/exo/src/TestHelper.h +++ b/compiler/exo/src/TestHelper.h @@ -26,7 +26,7 @@ #include <loco.h> -#include <stdex/Memory.h> +#include <memory> #include <gtest/gtest.h> @@ -54,11 +54,11 @@ public: TypeShapeReadyPhase() { // Type and Shape inference is prerequisite for run other test - _phase.emplace_back(stdex::make_unique<::exo::TypeInferencePass>()); - _phase.emplace_back(stdex::make_unique<::exo::ShapeInferencePass>()); + _phase.emplace_back(std::make_unique<::exo::TypeInferencePass>()); + _phase.emplace_back(std::make_unique<::exo::ShapeInferencePass>()); } - template <typename PassT> void add_pass() { _phase.emplace_back(stdex::make_unique<PassT>()); } + template <typename PassT> void add_pass() { _phase.emplace_back(std::make_unique<PassT>()); } void run(loco::Graph *g) { |