Skip to content

Commit

Permalink
Fixed cpplint warning/errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chenfeiyue-cfy committed Jun 7, 2024
1 parent 2db27a5 commit 053de77
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 11 deletions.
3 changes: 2 additions & 1 deletion onnxruntime/core/framework/node_unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <string>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
*
*****************************************************************************/
#pragma once

#include <memory>
#include <vector>
#include "core/providers/vsinpu/builders/op_builder.h"
#include "core/providers/vsinpu/vsinpu_ep_graph.h"
#include "core/providers/vsinpu/vsinpu_util.h"
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
namespace onnxruntime {
Expand All @@ -34,6 +37,7 @@ class CastOpBuilder : public BaseOpBuilder {
NodeAttrHelper helper(node_unit.GetNode());
auto op = graph_ep->GetGraph()->CreateOperation<tim::vx::ops::DataConvert>();
(*op).BindInput(inputs[0]).BindOutputs(outputs);
graph_ep->GetOps().push_back(std::move(op));
return true;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <limits>
#include <utility>
#include "core/providers/vsinpu/builders/impl/clip_op_builder.h"

namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/common.h"
#include "core/providers/shared/utils/utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <string>
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/common.h"
#include "core/providers/shared/utils/utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
namespace onnxruntime {
namespace vsi {
Expand Down Expand Up @@ -85,7 +88,6 @@ class PowOpBuilder : public BaseOpBuilder {
(*op).BindInputs(inputs).BindOutputs(outputs);
graph_ep->GetOps().push_back(std::move(op));
return true;
;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/common.h"
#include "core/providers/shared/utils/utils.h"
Expand All @@ -35,9 +38,9 @@ class FlattenOpBuilder : public BaseOpBuilder {
const NodeUnit& node_unit) override {
LOGS_DEFAULT(VERBOSE) << "Creating Flatten Op.";
std::vector<uint32_t> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
namespace onnxruntime {
Expand All @@ -35,6 +38,7 @@ class QLinearConcatOpBuilder : public BaseOpBuilder {
axis = util::ReverseAxis(axis, inputs[0]->GetShape().size());
auto op = graph_ep->GetGraph()->CreateOperation<tim::vx::ops::Concat>(axis, inputs.size());
(*op).BindInputs(inputs).BindOutputs(outputs);
graph_ep->GetOps().push_back(std::move(op));
return true;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <string>
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/shared/utils/utils.h"
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/framework/tensorprotoutils.h"
#include <variant>
namespace onnxruntime {
namespace vsi {
namespace npu {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

namespace onnxruntime {
Expand All @@ -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;
Expand All @@ -70,6 +73,7 @@ class QLinearMatMulOpBuilder : public BaseOpBuilder {
LOGS_DEFAULT(INFO) << "Creating QLinearMatmul Op.";
auto op = graph_ep->GetGraph()->CreateOperation<tim::vx::ops::Matmul>();
(*op).BindInputs(inputs).BindOutputs(outputs);
graph_ep->GetOps().push_back(std::move(op));
return true;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/common.h"
#include "core/providers/shared/utils/utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include <functional>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/common.h"
#include "core/providers/shared/utils/utils.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#include <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"

namespace onnxruntime {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <memory>
#include <vector>
#include <utility>
#include "core/providers/vsinpu/builders/impl/base_op_builder.h"
#include "core/providers/shared/utils/utils.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
*
*****************************************************************************/
#pragma once

#include <string>
#include <memory>
#include <map>
#include <utility>
#include "impl/activation_op_builder.h"
#include "impl/conv_op_builder.h"
#include "impl/elementwise_op_builder.h"
Expand Down

0 comments on commit 053de77

Please sign in to comment.