From 1b57ed0488ab7eed66e301cc39acc81039735f1e Mon Sep 17 00:00:00 2001 From: Feiyue Chen Date: Fri, 7 Jun 2024 02:20:56 +0000 Subject: [PATCH] Fixed cpplint warning/errors --- onnxruntime/core/framework/node_unit.cc | 3 ++- .../builders/impl/activation_op_builder.h | 3 +++ .../vsinpu/builders/impl/base_op_builder.cc | 1 + .../vsinpu/builders/impl/base_op_builder.h | 5 ++-- .../vsinpu/builders/impl/cast_op_builder.h | 4 +++ .../vsinpu/builders/impl/clip_op_builder.cc | 2 ++ .../vsinpu/builders/impl/clip_op_builder.h | 2 ++ .../vsinpu/builders/impl/concat_op_builder.h | 3 +++ .../vsinpu/builders/impl/conv_op_builder.h | 4 +++ .../builders/impl/dequantize_op_builder.h | 3 +++ .../builders/impl/elementwise_op_builder.h | 4 ++- .../vsinpu/builders/impl/flatten_op_builder.h | 7 +++-- .../vsinpu/builders/impl/gather_op_builder.h | 6 ++++- .../vsinpu/builders/impl/gemm_op_builder.h | 3 +++ .../vsinpu/builders/impl/matmul_op_builder.h | 3 +++ .../vsinpu/builders/impl/norm_op_builder.h | 3 +++ .../vsinpu/builders/impl/pool_op_builder.h | 5 +++- .../builders/impl/qlinear_binary_op_builder.h | 3 +++ .../builders/impl/qlinearconcat_op_builder.h | 4 +++ .../builders/impl/qlinearconv_op_builder.h | 5 +++- .../builders/impl/qlinearmatmul_op_builder.h | 8 ++++-- .../builders/impl/quantize_op_builder.h | 3 +++ .../vsinpu/builders/impl/reduce_op_builder.h | 3 +++ .../vsinpu/builders/impl/resize_op_builder.h | 15 ++++++++--- .../vsinpu/builders/impl/softmax_op_builder.h | 4 +++ .../vsinpu/builders/impl/squeeze_op_builder.h | 3 +++ .../vsinpu/builders/impl/tensor_op_builder.h | 3 +++ .../vsinpu/builders/impl/tile_op_builder.h | 3 +++ .../builders/impl/unsqueeze_op_builder.h | 26 +++++++++++++++++++ .../vsinpu/builders/op_builder_factory.h | 5 +++- 30 files changed, 130 insertions(+), 16 deletions(-) diff --git a/onnxruntime/core/framework/node_unit.cc b/onnxruntime/core/framework/node_unit.cc index 30412125fe587..fea89496002cd 100644 --- a/onnxruntime/core/framework/node_unit.cc +++ b/onnxruntime/core/framework/node_unit.cc @@ -337,7 +337,8 @@ void NodeUnit::InitForSingleNode() { } else if (IsVariadicQLinearOp(qlinear_type)) { size_t input_num = (input_defs.size() - 2) / 3; for (size_t i = 0; i < input_num; i++) { - inputs_.push_back(NodeUnitIODef{*input_defs[3 * i + 2], NodeUnitIODef::QuantParam{*input_defs[3 * i + 3], input_defs[3 * i + 4]}}); + inputs_.push_back(NodeUnitIODef{*input_defs[3 * i + 2], NodeUnitIODef::QuantParam{*input_defs[3 * i + 3], + input_defs[3 * i + 4]}}); } outputs_.push_back(NodeUnitIODef{*output_defs[0], NodeUnitIODef::QuantParam{*input_defs[0], input_defs[1]}}); } else { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/activation_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/activation_op_builder.h index 87881585cfe21..9a59d90365f64 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/activation_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/activation_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.cc b/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.cc index ba00dbf4f6baf..5755b21b0ecd8 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.cc +++ b/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.cc @@ -21,6 +21,7 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.h index c664c44d86e7a..95bc9c5569d1d 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/base_op_builder.h @@ -22,7 +22,8 @@ * *****************************************************************************/ #pragma once - +#include +#include #include "core/providers/vsinpu/builders/op_builder.h" #include "core/providers/vsinpu/vsinpu_ep_graph.h" #include "core/providers/vsinpu/vsinpu_util.h" @@ -54,7 +55,7 @@ class BaseOpBuilder : public IOpBuilder { const InitializedTensorSet& initializers, const NodeUnit& node_unit) const; // TODO:Check if this node_unit's type is supported - virtual bool IsNodeUnitTypeSupported(const NodeUnit& node_unit) const { return true; }; + virtual bool IsNodeUnitTypeSupported(const NodeUnit& node_unit) const { return true; } virtual bool HandleBuildOp( vsi::npu::GraphEP* graph_ep, diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/cast_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/cast_op_builder.h index 68c9702c8d9ba..6579f0ca9045f 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/cast_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/cast_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { @@ -34,6 +37,7 @@ class CastOpBuilder : public BaseOpBuilder { NodeAttrHelper helper(node_unit.GetNode()); auto op = graph_ep->GetGraph()->CreateOperation(); (*op).BindInput(inputs[0]).BindOutputs(outputs); + graph_ep->GetOps().push_back(std::move(op)); return true; } }; diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.cc b/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.cc index 92b560499d549..f3cccd69e3cf1 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.cc +++ b/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.cc @@ -21,6 +21,8 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include #include "core/providers/vsinpu/builders/impl/clip_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.h index 9ad1ae6c82009..8c056c5a2481a 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/clip_op_builder.h @@ -21,6 +21,8 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/concat_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/concat_op_builder.h index 1dfd115632586..4d3fc658b7bef 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/concat_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/concat_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/common.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/conv_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/conv_op_builder.h index 8e6b0112d1312..d4776910a3ac1 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/conv_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/conv_op_builder.h @@ -21,6 +21,10 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/dequantize_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/dequantize_op_builder.h index 760aed1fd3ecc..b4d1f6b19963f 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/dequantize_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/dequantize_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/common.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/elementwise_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/elementwise_op_builder.h index 3f26282fc078f..01c48699d61ca 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/elementwise_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/elementwise_op_builder.h @@ -22,6 +22,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { namespace vsi { @@ -85,7 +88,6 @@ class PowOpBuilder : public BaseOpBuilder { (*op).BindInputs(inputs).BindOutputs(outputs); graph_ep->GetOps().push_back(std::move(op)); return true; - ; } }; diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/flatten_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/flatten_op_builder.h index c92b2f73b00e0..dfb0bb9c1b99f 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/flatten_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/flatten_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/common.h" #include "core/providers/shared/utils/utils.h" @@ -35,9 +38,9 @@ class FlattenOpBuilder : public BaseOpBuilder { const NodeUnit& node_unit) override { LOGS_DEFAULT(VERBOSE) << "Creating Flatten Op."; std::vector reshape_param; - if (outputs[0]->GetShape().size() == 2) + if (outputs[0]->GetShape().size() == 2) { reshape_param = outputs[0]->GetShape(); - else { + } else { auto input_shape = inputs[0]->GetShape(); NodeAttrHelper helper(node_unit.GetNode()); int64_t axis = helper.Get("axis", 1); diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/gather_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/gather_op_builder.h index 97818927322e4..bd568873cd6d1 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/gather_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/gather_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" @@ -68,7 +71,8 @@ class GatherOpBuilder : public BaseOpBuilder { inputs[1]->CopyDataFromTensor(origin_data.data()); std::vector transformed_data(origin_data.begin(), origin_data.end()); auto transformed_indices = graph_ep->GetGraph()->CreateTensor( - inputs[1]->GetSpec().SetAttribute(tim::vx::TensorAttribute::INPUT).SetDataType(tim::vx::DataType::INT32), transformed_data.data()); + inputs[1]->GetSpec().SetAttribute(tim::vx::TensorAttribute::INPUT).SetDataType(tim::vx::DataType::INT32), + transformed_data.data()); (*op).BindInput(inputs[0]).BindInput(transformed_indices).BindOutput(outputs[0]); } graph_ep->GetOps().push_back(std::move(op)); diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/gemm_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/gemm_op_builder.h index 5fc0406a3f94e..6f5b484ce3a20 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/gemm_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/gemm_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/matmul_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/matmul_op_builder.h index 48ca4d86e6d75..8cdf72906b644 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/matmul_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/matmul_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/norm_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/norm_op_builder.h index f9d7dbe7183fc..98149dc8de63d 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/norm_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/norm_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/pool_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/pool_op_builder.h index 3575bbbc5194d..63d9a0d79f7de 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/pool_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/pool_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" @@ -29,7 +32,7 @@ namespace vsi { namespace npu { class BasePoolOpBuilder : public BaseOpBuilder { public: - BasePoolOpBuilder(tim::vx::PoolType pool_type) : pool_type_(pool_type) {} + explicit BasePoolOpBuilder(tim::vx::PoolType pool_type) : pool_type_(pool_type) {} protected: bool IsOpSupported(const onnxruntime::GraphViewer& graph_viewer, const Node* node) const override { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/qlinear_binary_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/qlinear_binary_op_builder.h index c76bbbb4a7f55..def37b1ec1019 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/qlinear_binary_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/qlinear_binary_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconcat_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconcat_op_builder.h index eb5f79ee60ff9..dc51e99730c15 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconcat_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconcat_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { @@ -35,6 +38,7 @@ class QLinearConcatOpBuilder : public BaseOpBuilder { axis = util::ReverseAxis(axis, inputs[0]->GetShape().size()); auto op = graph_ep->GetGraph()->CreateOperation(axis, inputs.size()); (*op).BindInputs(inputs).BindOutputs(outputs); + graph_ep->GetOps().push_back(std::move(op)); return true; } }; diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconv_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconv_op_builder.h index cbb1d878089ce..c9b4721dd160a 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconv_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearconv_op_builder.h @@ -21,10 +21,13 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include +#include #include "core/providers/shared/utils/utils.h" #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/framework/tensorprotoutils.h" -#include namespace onnxruntime { namespace vsi { namespace npu { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearmatmul_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearmatmul_op_builder.h index f38c9955ae48e..7447c8b6b0b91 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/qlinearmatmul_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/qlinearmatmul_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { @@ -44,9 +47,9 @@ class QLinearMatMulOpBuilder : public BaseOpBuilder { auto A_def = input_defs[matrixA]; auto B_def = input_defs[matrixB]; for (auto def : input_defs) { - if (def->Name() == A_def->Name() || def->Name() == B_def->Name()) + if (def->Name() == A_def->Name() || def->Name() == B_def->Name()) { continue; - else { + } else { if (!graph_viewer.IsConstantInitializer(def->Name(), true)) { LOGS_DEFAULT(WARNING) << "Scale and zero point must be known before setting graph."; return false; @@ -70,6 +73,7 @@ class QLinearMatMulOpBuilder : public BaseOpBuilder { LOGS_DEFAULT(INFO) << "Creating QLinearMatmul Op."; auto op = graph_ep->GetGraph()->CreateOperation(); (*op).BindInputs(inputs).BindOutputs(outputs); + graph_ep->GetOps().push_back(std::move(op)); return true; } }; diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/quantize_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/quantize_op_builder.h index 9dbfe32947e1b..155dedbc44f4c 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/quantize_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/quantize_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/common.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/reduce_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/reduce_op_builder.h index 0ddf106da75b6..3b0a282c5de89 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/reduce_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/reduce_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/resize_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/resize_op_builder.h index cc49461940aed..4ce8786e28d85 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/resize_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/resize_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" @@ -108,11 +111,13 @@ class ResizeOpBuilder : public BaseOpBuilder { int64_t onnx_size; inputs[3]->CopyDataFromTensor(&onnx_size); target_size = static_cast(onnx_size); - op = graph_ep->GetGraph()->CreateOperation(resize_type, 0.0f, align_corners, half_pixel_center, target_size); + op = graph_ep->GetGraph()->CreateOperation(resize_type, 0.0f, align_corners, + half_pixel_center, target_size); } else { float scale; inputs[scale_index]->CopyDataFromTensor(&scale); - op = graph_ep->GetGraph()->CreateOperation(resize_type, scale, align_corners, half_pixel_center, 0); + op = graph_ep->GetGraph()->CreateOperation(resize_type, scale, align_corners, + half_pixel_center, 0); } } else { int target_height, target_width; @@ -121,7 +126,8 @@ class ResizeOpBuilder : public BaseOpBuilder { inputs[3]->CopyDataFromTensor(onnx_sizes.data()); target_height = static_cast(onnx_sizes[1]); target_width = static_cast(onnx_sizes[0]); - op = graph_ep->GetGraph()->CreateOperation(resize_type, 0.0f, align_corners, half_pixel_center, target_height, target_width); + op = graph_ep->GetGraph()->CreateOperation(resize_type, 0.0f, align_corners, + half_pixel_center, target_height, target_width); } else { auto input_shape = inputs[0]->GetShape(); std::vector scales(input_shape.size()); @@ -130,7 +136,8 @@ class ResizeOpBuilder : public BaseOpBuilder { for (int i = 0; i < input_shape.size(); i++) { out_shape[i] = input_shape[i] * scales[input_shape.size() - 1 - i]; } - op = graph_ep->GetGraph()->CreateOperation(resize_type, 0, align_corners, half_pixel_center, out_shape[1], out_shape[0]); + op = graph_ep->GetGraph()->CreateOperation(resize_type, 0, align_corners, + half_pixel_center, out_shape[1], out_shape[0]); } } diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/softmax_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/softmax_op_builder.h index 1509077cced44..b8a0b7488710a 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/softmax_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/softmax_op_builder.h @@ -21,6 +21,10 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/common.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/squeeze_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/squeeze_op_builder.h index 54174060c6381..2e1837384618d 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/squeeze_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/squeeze_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/tensor_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/tensor_op_builder.h index 8fc6b8b0b531c..427457b521b61 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/tensor_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/tensor_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/tile_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/tile_op_builder.h index cb81ab82f7c88..d42624c31557c 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/tile_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/tile_op_builder.h @@ -21,6 +21,9 @@ * DEALINGS IN THE SOFTWARE. * *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" namespace onnxruntime { diff --git a/onnxruntime/core/providers/vsinpu/builders/impl/unsqueeze_op_builder.h b/onnxruntime/core/providers/vsinpu/builders/impl/unsqueeze_op_builder.h index 40fe93c6b8454..c49c93008b25a 100644 --- a/onnxruntime/core/providers/vsinpu/builders/impl/unsqueeze_op_builder.h +++ b/onnxruntime/core/providers/vsinpu/builders/impl/unsqueeze_op_builder.h @@ -1,3 +1,29 @@ +/**************************************************************************** + * + * Copyright (c) 2024 Vivante Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + *****************************************************************************/ +#include +#include +#include #include "core/providers/vsinpu/builders/impl/base_op_builder.h" #include "core/providers/shared/utils/utils.h" diff --git a/onnxruntime/core/providers/vsinpu/builders/op_builder_factory.h b/onnxruntime/core/providers/vsinpu/builders/op_builder_factory.h index 6538ee3078505..3a9190d8cb03a 100644 --- a/onnxruntime/core/providers/vsinpu/builders/op_builder_factory.h +++ b/onnxruntime/core/providers/vsinpu/builders/op_builder_factory.h @@ -22,7 +22,10 @@ * *****************************************************************************/ #pragma once - +#include +#include +#include +#include #include "impl/activation_op_builder.h" #include "impl/conv_op_builder.h" #include "impl/elementwise_op_builder.h"