diff options
Diffstat (limited to 'runtime/onert/core/src/ir/operation')
70 files changed, 274 insertions, 278 deletions
diff --git a/runtime/onert/core/src/ir/operation/LowerInfo.cc b/runtime/onert/core/src/ir/operation/AddN.cc index 249918bd6..a51e12dff 100644 --- a/runtime/onert/core/src/ir/operation/LowerInfo.cc +++ b/runtime/onert/core/src/ir/operation/AddN.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,8 @@ * limitations under the License. */ -#include "ir/operation/LowerInfo.h" +#include "ir/operation/AddN.h" +#include "ir/OperationVisitor.h" namespace onert { @@ -23,10 +24,11 @@ namespace ir namespace operation { -LowerInfo::LowerInfo(const backend::Backend *backend, Layout layout) - : _permute_factor{backend, layout} +void AddN::accept(OperationVisitor &v) const { v.visit(*this); } + +AddN::AddN(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : Operation{OperandConstraint::createExact(inputs.size()), inputs, outputs} { - // DO NOTHING } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/ArgMax.cc b/runtime/onert/core/src/ir/operation/ArgMinMax.cc index 1275ae43a..2f18ff2e2 100644 --- a/runtime/onert/core/src/ir/operation/ArgMax.cc +++ b/runtime/onert/core/src/ir/operation/ArgMinMax.cc @@ -14,10 +14,7 @@ * limitations under the License. */ -#include "ir/operation/ArgMax.h" - -#include <cassert> - +#include "ir/operation/ArgMinMax.h" #include "ir/OperationVisitor.h" namespace onert @@ -27,11 +24,11 @@ namespace ir namespace operation { -void ArgMax::accept(OperationVisitor &v) const { v.visit(*this); } +void ArgMinMax::accept(OperationVisitor &v) const { v.visit(*this); } -ArgMax::ArgMax(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, - const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +ArgMinMax::ArgMinMax(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/BCQFullyConnected.cc b/runtime/onert/core/src/ir/operation/BCQFullyConnected.cc index 9dc54e6e9..ccda674ad 100644 --- a/runtime/onert/core/src/ir/operation/BCQFullyConnected.cc +++ b/runtime/onert/core/src/ir/operation/BCQFullyConnected.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/BCQFullyConnected.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void BCQFullyConnected::accept(OperationVisitor &v) const { v.visit(*this); } BCQFullyConnected::BCQFullyConnected(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(5u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(5u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/BCQGather.cc b/runtime/onert/core/src/ir/operation/BCQGather.cc index 80efa6460..1ca5b0c9f 100644 --- a/runtime/onert/core/src/ir/operation/BCQGather.cc +++ b/runtime/onert/core/src/ir/operation/BCQGather.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/BCQGather.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void BCQGather::accept(OperationVisitor &v) const { v.visit(*this); } BCQGather::BCQGather(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/BatchMatMul.cc b/runtime/onert/core/src/ir/operation/BatchMatMul.cc index b9616158d..20c5682f9 100644 --- a/runtime/onert/core/src/ir/operation/BatchMatMul.cc +++ b/runtime/onert/core/src/ir/operation/BatchMatMul.cc @@ -28,7 +28,7 @@ void BatchMatMul::accept(OperationVisitor &v) const { v.visit(*this); } BatchMatMul::BatchMatMul(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/BatchToSpaceND.cc b/runtime/onert/core/src/ir/operation/BatchToSpaceND.cc index 9ef2b125f..3c5578ac4 100644 --- a/runtime/onert/core/src/ir/operation/BatchToSpaceND.cc +++ b/runtime/onert/core/src/ir/operation/BatchToSpaceND.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/BatchToSpaceND.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void BatchToSpaceND::accept(OperationVisitor &v) const { v.visit(*this); } BatchToSpaceND::BatchToSpaceND(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createInRange(2u, 3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/BinaryArithmetic.cc b/runtime/onert/core/src/ir/operation/BinaryArithmetic.cc index 2b1422c73..5eb3fc3d7 100644 --- a/runtime/onert/core/src/ir/operation/BinaryArithmetic.cc +++ b/runtime/onert/core/src/ir/operation/BinaryArithmetic.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/BinaryArithmetic.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -32,7 +30,7 @@ void BinaryArithmetic::accept(OperationVisitor &v) const { v.visit(*this); } BinaryArithmetic::BinaryArithmetic(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } @@ -40,10 +38,10 @@ std::string BinaryArithmetic::name() const { using ArithmeticType = onert::ir::operation::BinaryArithmetic::ArithmeticType; static const std::unordered_map<ArithmeticType, std::string> name_map{ - {ArithmeticType::ADD, std::string{"Add"}}, - {ArithmeticType::SUB, std::string{"Sub"}}, - {ArithmeticType::MUL, std::string{"Mul"}}, - {ArithmeticType::DIV, std::string{"Div"}}}; + {ArithmeticType::ADD, std::string{"Add"}}, + {ArithmeticType::SUB, std::string{"Sub"}}, + {ArithmeticType::MUL, std::string{"Mul"}}, + {ArithmeticType::DIV, std::string{"Div"}}}; return name_map.at(_param.arithmetic_type); } diff --git a/runtime/onert/core/src/ir/operation/BroadcastTo.cc b/runtime/onert/core/src/ir/operation/BroadcastTo.cc index a8f5e59cf..eab6c0611 100644 --- a/runtime/onert/core/src/ir/operation/BroadcastTo.cc +++ b/runtime/onert/core/src/ir/operation/BroadcastTo.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/BroadcastTo.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -29,7 +26,7 @@ namespace operation void BroadcastTo::accept(OperationVisitor &v) const { v.visit(*this); } BroadcastTo::BroadcastTo(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Bulk.cc b/runtime/onert/core/src/ir/operation/Bulk.cc new file mode 100644 index 000000000..4b96c9d94 --- /dev/null +++ b/runtime/onert/core/src/ir/operation/Bulk.cc @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ir/operation/Bulk.h" +#include "ir/OperationVisitor.h" + +namespace onert +{ +namespace ir +{ +namespace operation +{ +void Bulk::accept(OperationVisitor &v) const { v.visit(*this); } + +Bulk::Bulk(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Bulk::Param ¶m) + : Operation{OperandConstraint::createAny(), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace ir +} // namespace onert diff --git a/runtime/onert/core/src/ir/operation/Comparison.cc b/runtime/onert/core/src/ir/operation/Comparison.cc index 2f6775411..33365657c 100644 --- a/runtime/onert/core/src/ir/operation/Comparison.cc +++ b/runtime/onert/core/src/ir/operation/Comparison.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Comparison.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Comparison::accept(OperationVisitor &v) const { v.visit(*this); } Comparison::Comparison(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Concat.cc b/runtime/onert/core/src/ir/operation/Concat.cc index 608bc29a6..3a21e36f2 100644 --- a/runtime/onert/core/src/ir/operation/Concat.cc +++ b/runtime/onert/core/src/ir/operation/Concat.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Concat.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Concat::accept(OperationVisitor &v) const { v.visit(*this); } Concat::Concat(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Conv2D.cc b/runtime/onert/core/src/ir/operation/Conv2D.cc index 3a2e1d1fe..d615ae416 100644 --- a/runtime/onert/core/src/ir/operation/Conv2D.cc +++ b/runtime/onert/core/src/ir/operation/Conv2D.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Conv2D.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Conv2D::accept(OperationVisitor &v) const { v.visit(*this); } Conv2D::Conv2D(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/ConvertFp16ToFp32.cc b/runtime/onert/core/src/ir/operation/ConvertFp16ToFp32.cc index 676e039fa..365745ea8 100644 --- a/runtime/onert/core/src/ir/operation/ConvertFp16ToFp32.cc +++ b/runtime/onert/core/src/ir/operation/ConvertFp16ToFp32.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/ConvertFp16ToFp32.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void ConvertFp16ToFp32::accept(OperationVisitor &v) const { v.visit(*this); } ConvertFp16ToFp32::ConvertFp16ToFp32(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(1u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/ConvertFp32ToFp16.cc b/runtime/onert/core/src/ir/operation/ConvertFp32ToFp16.cc index bcfcbfc04..d4fc7031c 100644 --- a/runtime/onert/core/src/ir/operation/ConvertFp32ToFp16.cc +++ b/runtime/onert/core/src/ir/operation/ConvertFp32ToFp16.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/ConvertFp32ToFp16.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void ConvertFp32ToFp16::accept(OperationVisitor &v) const { v.visit(*this); } ConvertFp32ToFp16::ConvertFp32ToFp16(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(1u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Custom.cc b/runtime/onert/core/src/ir/operation/Custom.cc index 25c53e1ba..06c84f81a 100644 --- a/runtime/onert/core/src/ir/operation/Custom.cc +++ b/runtime/onert/core/src/ir/operation/Custom.cc @@ -29,7 +29,7 @@ void Custom::accept(OperationVisitor &v) const { v.visit(*this); } Custom::Custom(OperandConstraint input_constr, const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, std::string id, const Userdata &userdata) - : Operation{input_constr, inputs, outputs}, _id(std::move(id)), _userdata(userdata) + : Operation{input_constr, inputs, outputs}, _id(std::move(id)), _userdata(userdata) { } diff --git a/runtime/onert/core/src/ir/operation/DepthToSpace.cc b/runtime/onert/core/src/ir/operation/DepthToSpace.cc index f2d6c7c1b..e3edea777 100644 --- a/runtime/onert/core/src/ir/operation/DepthToSpace.cc +++ b/runtime/onert/core/src/ir/operation/DepthToSpace.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/DepthToSpace.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void DepthToSpace::accept(OperationVisitor &v) const { v.visit(*this); } DepthToSpace::DepthToSpace(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/DepthwiseConv2D.cc b/runtime/onert/core/src/ir/operation/DepthwiseConv2D.cc index d587a5591..0e7137306 100644 --- a/runtime/onert/core/src/ir/operation/DepthwiseConv2D.cc +++ b/runtime/onert/core/src/ir/operation/DepthwiseConv2D.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/DepthwiseConv2D.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void DepthwiseConv2D::accept(OperationVisitor &v) const { v.visit(*this); } DepthwiseConv2D::DepthwiseConv2D(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/DetectionPostProcess.cc b/runtime/onert/core/src/ir/operation/DetectionPostProcess.cc new file mode 100644 index 000000000..cd708796d --- /dev/null +++ b/runtime/onert/core/src/ir/operation/DetectionPostProcess.cc @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ir/operation/DetectionPostProcess.h" +#include "ir/OperationVisitor.h" + +namespace onert +{ +namespace ir +{ +namespace operation +{ + +DetectionPostProcess::DetectionPostProcess(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : Operation(OperandConstraint::createExact(3u), inputs, outputs), _param(param) +{ +} + +void DetectionPostProcess::accept(OperationVisitor &v) const { v.visit(*this); } + +} // namespace operation +} // namespace ir +} // namespace onert diff --git a/runtime/onert/core/src/ir/operation/Einsum.cc b/runtime/onert/core/src/ir/operation/Einsum.cc index 3c1473aaa..b50f070e7 100644 --- a/runtime/onert/core/src/ir/operation/Einsum.cc +++ b/runtime/onert/core/src/ir/operation/Einsum.cc @@ -28,7 +28,7 @@ void Einsum::accept(OperationVisitor &v) const { v.visit(*this); } Einsum::Einsum(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/ElementwiseActivation.cc b/runtime/onert/core/src/ir/operation/ElementwiseActivation.cc index f6718b656..e83c26e28 100644 --- a/runtime/onert/core/src/ir/operation/ElementwiseActivation.cc +++ b/runtime/onert/core/src/ir/operation/ElementwiseActivation.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/ElementwiseActivation.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -33,13 +31,14 @@ void ElementwiseActivation::accept(OperationVisitor &v) const { v.visit(*this); ElementwiseActivation::ElementwiseActivation(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { if (param.op_type == Type::LOGISTIC) { - assert(param.alpha == 0.0f && param.beta == 0.0f && "Logistic will be supported only as " - "sigmoid function(L=1, k=1, x0=0). So, do " - "not use alpha and beta"); + assert(param.alpha == 0.0f && param.beta == 0.0f && + "Logistic will be supported only as " + "sigmoid function(L=1, k=1, x0=0). So, do " + "not use alpha and beta"); } else if (param.op_type == Type::RELU) { @@ -47,9 +46,10 @@ ElementwiseActivation::ElementwiseActivation(const OperandIndexSequence &inputs, } else if (param.op_type == Type::TANH) { - assert(param.alpha == 1.0f && param.beta == 1.0f && "f(x) = alpha * tanh(beta * x), Tanh is " - "supported only the values of alpha and " - "beta are 1.f"); + assert(param.alpha == 1.0f && param.beta == 1.0f && + "f(x) = alpha * tanh(beta * x), Tanh is " + "supported only the values of alpha and " + "beta are 1.f"); } } @@ -57,11 +57,11 @@ std::string ElementwiseActivation::name() const { using ElementwiseActivationType = onert::ir::operation::ElementwiseActivation::Type; static const std::unordered_map<Type, std::string> name_map{ - {ElementwiseActivationType::ELU, "ELU"}, - {ElementwiseActivationType::LOGISTIC, "Logistic"}, - {ElementwiseActivationType::RELU, "ReLU"}, - {ElementwiseActivationType::TANH, "Tanh"}, - {ElementwiseActivationType::LEAKY_RELU, "LeakyRelu"}}; + {ElementwiseActivationType::ELU, "ELU"}, + {ElementwiseActivationType::LOGISTIC, "Logistic"}, + {ElementwiseActivationType::RELU, "ReLU"}, + {ElementwiseActivationType::TANH, "Tanh"}, + {ElementwiseActivationType::LEAKY_RELU, "LeakyRelu"}}; return name_map.at(_param.op_type); } diff --git a/runtime/onert/core/src/ir/operation/ElementwiseBinary.cc b/runtime/onert/core/src/ir/operation/ElementwiseBinary.cc index 3287fc0a3..b22bed7bc 100644 --- a/runtime/onert/core/src/ir/operation/ElementwiseBinary.cc +++ b/runtime/onert/core/src/ir/operation/ElementwiseBinary.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/ElementwiseBinary.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -32,7 +30,7 @@ void ElementwiseBinary::accept(OperationVisitor &v) const { v.visit(*this); } ElementwiseBinary::ElementwiseBinary(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } @@ -40,10 +38,11 @@ std::string ElementwiseBinary::name() const { using ElementwiseBinaryType = onert::ir::operation::ElementwiseBinary::ElementwiseBinaryType; static const std::unordered_map<ElementwiseBinaryType, std::string> name_map{ - {ElementwiseBinaryType::LOGICAL_AND, std::string{"LogicalAnd"}}, - {ElementwiseBinaryType::LOGICAL_OR, std::string{"LogicalOr"}}, - {ElementwiseBinaryType::MAX, std::string{"Max"}}, - {ElementwiseBinaryType::MIN, std::string{"Min"}}}; + {ElementwiseBinaryType::FLOOR_DIV, std::string{"FloorDiv"}}, + {ElementwiseBinaryType::LOGICAL_AND, std::string{"LogicalAnd"}}, + {ElementwiseBinaryType::LOGICAL_OR, std::string{"LogicalOr"}}, + {ElementwiseBinaryType::MAX, std::string{"Max"}}, + {ElementwiseBinaryType::MIN, std::string{"Min"}}}; return name_map.at(_param.op_type); } diff --git a/runtime/onert/core/src/ir/operation/ElementwiseUnary.cc b/runtime/onert/core/src/ir/operation/ElementwiseUnary.cc index 7dfcd4a98..fd463e0fe 100644 --- a/runtime/onert/core/src/ir/operation/ElementwiseUnary.cc +++ b/runtime/onert/core/src/ir/operation/ElementwiseUnary.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/ElementwiseUnary.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -32,7 +30,9 @@ void ElementwiseUnary::accept(OperationVisitor &v) const { v.visit(*this); } ElementwiseUnary::ElementwiseUnary(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs, + OperandConstraint::createExact(1u)}, + _param{param} { } @@ -40,23 +40,23 @@ std::string ElementwiseUnary::name() const { using ElementwiseUnaryType = onert::ir::operation::ElementwiseUnary::Type; static const std::unordered_map<ElementwiseUnaryType, std::string> name_map{ - {ElementwiseUnaryType::ABS, std::string{"Abs"}}, - {ElementwiseUnaryType::CAST, std::string{"Cast"}}, - {ElementwiseUnaryType::COS, std::string{"Cos"}}, - {ElementwiseUnaryType::DEQUANTIZE, std::string{"Dequantize"}}, - {ElementwiseUnaryType::ERF, std::string{"Erf"}}, - {ElementwiseUnaryType::EXP, std::string{"Exp"}}, - {ElementwiseUnaryType::FLOOR, std::string{"Floor"}}, - {ElementwiseUnaryType::LOG, std::string{"Log"}}, - {ElementwiseUnaryType::LOGICAL_NOT, std::string{"LogicalNot"}}, - {ElementwiseUnaryType::NEG, std::string{"Neg"}}, - {ElementwiseUnaryType::QUANTIZE, std::string{"Quantize"}}, - {ElementwiseUnaryType::ROUND, std::string{"Round"}}, - {ElementwiseUnaryType::RSQRT, std::string{"RSqrt"}}, - {ElementwiseUnaryType::SIN, std::string{"Sin"}}, - {ElementwiseUnaryType::SQRT, std::string{"Sqrt"}}, - {ElementwiseUnaryType::SQURE, std::string{"Squre"}}, - {ElementwiseUnaryType::ZEROS_LIKE, std::string{"ZerosLike"}}}; + {ElementwiseUnaryType::ABS, std::string{"Abs"}}, + {ElementwiseUnaryType::CAST, std::string{"Cast"}}, + {ElementwiseUnaryType::COS, std::string{"Cos"}}, + {ElementwiseUnaryType::DEQUANTIZE, std::string{"Dequantize"}}, + {ElementwiseUnaryType::ERF, std::string{"Erf"}}, + {ElementwiseUnaryType::EXP, std::string{"Exp"}}, + {ElementwiseUnaryType::FLOOR, std::string{"Floor"}}, + {ElementwiseUnaryType::LOG, std::string{"Log"}}, + {ElementwiseUnaryType::LOGICAL_NOT, std::string{"LogicalNot"}}, + {ElementwiseUnaryType::NEG, std::string{"Neg"}}, + {ElementwiseUnaryType::QUANTIZE, std::string{"Quantize"}}, + {ElementwiseUnaryType::ROUND, std::string{"Round"}}, + {ElementwiseUnaryType::RSQRT, std::string{"RSqrt"}}, + {ElementwiseUnaryType::SIN, std::string{"Sin"}}, + {ElementwiseUnaryType::SQRT, std::string{"Sqrt"}}, + {ElementwiseUnaryType::SQUARE, std::string{"Square"}}, + {ElementwiseUnaryType::ZEROS_LIKE, std::string{"ZerosLike"}}}; return name_map.at(_param.op_type); } diff --git a/runtime/onert/core/src/ir/operation/EmbeddingLookup.cc b/runtime/onert/core/src/ir/operation/EmbeddingLookup.cc index b300b004e..66b80b2c5 100644 --- a/runtime/onert/core/src/ir/operation/EmbeddingLookup.cc +++ b/runtime/onert/core/src/ir/operation/EmbeddingLookup.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/EmbeddingLookup.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void EmbeddingLookup::accept(OperationVisitor &v) const { v.visit(*this); } EmbeddingLookup::EmbeddingLookup(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/ExpandDims.cc b/runtime/onert/core/src/ir/operation/ExpandDims.cc index 3f555bd23..e421bc383 100644 --- a/runtime/onert/core/src/ir/operation/ExpandDims.cc +++ b/runtime/onert/core/src/ir/operation/ExpandDims.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/ExpandDims.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void ExpandDims::accept(OperationVisitor &v) const { v.visit(*this); } ExpandDims::ExpandDims(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Fill.cc b/runtime/onert/core/src/ir/operation/Fill.cc index c44f45aab..60355c609 100644 --- a/runtime/onert/core/src/ir/operation/Fill.cc +++ b/runtime/onert/core/src/ir/operation/Fill.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Fill.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Fill::accept(OperationVisitor &v) const { v.visit(*this); } Fill::Fill(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/FullyConnected.cc b/runtime/onert/core/src/ir/operation/FullyConnected.cc index 118ae554a..3533df097 100644 --- a/runtime/onert/core/src/ir/operation/FullyConnected.cc +++ b/runtime/onert/core/src/ir/operation/FullyConnected.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/FullyConnected.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void FullyConnected::accept(OperationVisitor &v) const { v.visit(*this); } FullyConnected::FullyConnected(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createInRange(2u, 3u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/FusedBatchNorm.cc b/runtime/onert/core/src/ir/operation/FusedBatchNorm.cc index 7b9301ea6..b5679f308 100644 --- a/runtime/onert/core/src/ir/operation/FusedBatchNorm.cc +++ b/runtime/onert/core/src/ir/operation/FusedBatchNorm.cc @@ -28,7 +28,7 @@ void FusedBatchNorm::accept(OperationVisitor &v) const { v.visit(*this); } FusedBatchNorm::FusedBatchNorm(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAtLeast(5u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAtLeast(5u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Gather.cc b/runtime/onert/core/src/ir/operation/Gather.cc index 11d46e75b..e0c4630a0 100644 --- a/runtime/onert/core/src/ir/operation/Gather.cc +++ b/runtime/onert/core/src/ir/operation/Gather.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Gather.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Gather::accept(OperationVisitor &v) const { v.visit(*this); } Gather::Gather(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/HashtableLookup.cc b/runtime/onert/core/src/ir/operation/HashtableLookup.cc index e9a7a82ff..5d1589cd1 100644 --- a/runtime/onert/core/src/ir/operation/HashtableLookup.cc +++ b/runtime/onert/core/src/ir/operation/HashtableLookup.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/HashtableLookup.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void HashtableLookup::accept(OperationVisitor &v) const { v.visit(*this); } HashtableLookup::HashtableLookup(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/If.cc b/runtime/onert/core/src/ir/operation/If.cc index 599751dfd..380c87dbe 100644 --- a/runtime/onert/core/src/ir/operation/If.cc +++ b/runtime/onert/core/src/ir/operation/If.cc @@ -24,7 +24,7 @@ namespace operation { void If::accept(OperationVisitor &v) const { v.visit(*this); } If::If(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAny(), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAny(), inputs, outputs}, _param{param} { } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/InstanceNorm.cc b/runtime/onert/core/src/ir/operation/InstanceNorm.cc index 2334560ef..9fb55383e 100644 --- a/runtime/onert/core/src/ir/operation/InstanceNorm.cc +++ b/runtime/onert/core/src/ir/operation/InstanceNorm.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/InstanceNorm.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void InstanceNorm::accept(OperationVisitor &v) const { v.visit(*this); } InstanceNorm::InstanceNorm(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/L2Normalization.cc b/runtime/onert/core/src/ir/operation/L2Normalization.cc index 9a7d3eb61..6725df596 100644 --- a/runtime/onert/core/src/ir/operation/L2Normalization.cc +++ b/runtime/onert/core/src/ir/operation/L2Normalization.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/L2Normalization.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void L2Normalization::accept(OperationVisitor &v) const { v.visit(*this); } L2Normalization::L2Normalization(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(1u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/LSTM.cc b/runtime/onert/core/src/ir/operation/LSTM.cc index 30a865326..06e66158b 100644 --- a/runtime/onert/core/src/ir/operation/LSTM.cc +++ b/runtime/onert/core/src/ir/operation/LSTM.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/LSTM.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,8 +28,16 @@ void LSTM::accept(OperationVisitor &v) const { v.visit(*this); } LSTM::LSTM(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(23u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createInRange(20u, 24u), inputs, outputs}, _param{param} +{ +} + +std::string LSTM::name() const { + if (getOutputs().at(Output::SCRATCH_BUFFER).undefined()) + return std::string{"UnidirectionalSequenceLSTM"}; + else + return Operation::name(); } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/LocalResponseNormalization.cc b/runtime/onert/core/src/ir/operation/LocalResponseNormalization.cc index 1ae97c142..73fca9938 100644 --- a/runtime/onert/core/src/ir/operation/LocalResponseNormalization.cc +++ b/runtime/onert/core/src/ir/operation/LocalResponseNormalization.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/LocalResponseNormalization.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -32,7 +29,7 @@ void LocalResponseNormalization::accept(OperationVisitor &v) const { v.visit(*th LocalResponseNormalization::LocalResponseNormalization(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/LogSoftmax.cc b/runtime/onert/core/src/ir/operation/LogSoftmax.cc index 73c6580ec..d580e63e1 100644 --- a/runtime/onert/core/src/ir/operation/LogSoftmax.cc +++ b/runtime/onert/core/src/ir/operation/LogSoftmax.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/LogSoftmax.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void LogSoftmax::accept(OperationVisitor &v) const { v.visit(*this); } LogSoftmax::LogSoftmax(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Loss.cc b/runtime/onert/core/src/ir/operation/Loss.cc new file mode 100644 index 000000000..fa3520b2c --- /dev/null +++ b/runtime/onert/core/src/ir/operation/Loss.cc @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ir/operation/Loss.h" +#include "ir/OperationVisitor.h" + +#include <unordered_map> + +namespace onert +{ +namespace ir +{ +namespace operation +{ + +void Loss::accept(OperationVisitor &v) const { v.visit(*this); } + +Loss::Loss(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : Operation{OperandConstraint::createAtLeast(2u), inputs, outputs}, _param{param} +{ + if (param.op_type == Type::CATEGORICAL_CROSSENTROPY) + { + assert(inputs.size() == 2 && "CategoricalCrossentropy Loss has 2 inputs"); + } +} + +std::string Loss::name() const +{ + using LossType = onert::ir::operation::Loss::Type; + static const std::unordered_map<Type, std::string> name_map{ + {LossType::MEAN_SQUARED_ERROR, "MeanSquaredError Loss"}, + {LossType::CATEGORICAL_CROSSENTROPY, "CategoricalCrossentropy Loss"}}; + return name_map.at(_param.op_type); +} + +} // namespace operation +} // namespace ir +} // namespace onert diff --git a/runtime/onert/core/src/ir/operation/MatrixBandPart.cc b/runtime/onert/core/src/ir/operation/MatrixBandPart.cc index bac31f13e..e52bddc1f 100644 --- a/runtime/onert/core/src/ir/operation/MatrixBandPart.cc +++ b/runtime/onert/core/src/ir/operation/MatrixBandPart.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/MatrixBandPart.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void MatrixBandPart::accept(OperationVisitor &v) const { v.visit(*this); } MatrixBandPart::MatrixBandPart(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/OneHot.cc b/runtime/onert/core/src/ir/operation/OneHot.cc index 22935e7d6..90898f1ed 100644 --- a/runtime/onert/core/src/ir/operation/OneHot.cc +++ b/runtime/onert/core/src/ir/operation/OneHot.cc @@ -28,7 +28,7 @@ void OneHot::accept(OperationVisitor &v) const { v.visit(*this); } OneHot::OneHot(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/PReLU.cc b/runtime/onert/core/src/ir/operation/PReLU.cc index a2e37e0ad..87bd12e60 100644 --- a/runtime/onert/core/src/ir/operation/PReLU.cc +++ b/runtime/onert/core/src/ir/operation/PReLU.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/PReLU.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void PReLU::accept(OperationVisitor &v) const { v.visit(*this); } PReLU::PReLU(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Pack.cc b/runtime/onert/core/src/ir/operation/Pack.cc index f0908a2c6..00feadfb0 100644 --- a/runtime/onert/core/src/ir/operation/Pack.cc +++ b/runtime/onert/core/src/ir/operation/Pack.cc @@ -25,7 +25,7 @@ namespace operation void Pack::accept(OperationVisitor &v) const { v.visit(*this); } Pack::Pack(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAtLeast(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} { } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/Pad.cc b/runtime/onert/core/src/ir/operation/Pad.cc index 0c56e92e3..a3f2d9752 100644 --- a/runtime/onert/core/src/ir/operation/Pad.cc +++ b/runtime/onert/core/src/ir/operation/Pad.cc @@ -30,7 +30,7 @@ void Pad::accept(OperationVisitor &v) const { v.visit(*this); } // PAD: 2 inputs // PADV2: 3 inputs Pad::Pad(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createInRange(2u, 3u), inputs, outputs} + : Operation{OperandConstraint::createInRange(2u, 3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Permute.cc b/runtime/onert/core/src/ir/operation/Permute.cc index eefb6c542..813fbaf30 100644 --- a/runtime/onert/core/src/ir/operation/Permute.cc +++ b/runtime/onert/core/src/ir/operation/Permute.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Permute.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Permute::accept(OperationVisitor &v) const { v.visit(*this); } Permute::Permute(const OperandIndex &input, const OperandIndex &output, Type type) - : Operation{OperandConstraint::createExact(1u)}, _type{type} + : Operation{OperandConstraint::createExact(1u)}, _type{type} { setInputs({input}); setOutputs({output}); diff --git a/runtime/onert/core/src/ir/operation/Pool2D.cc b/runtime/onert/core/src/ir/operation/Pool2D.cc index 761d14c3d..e32b876e6 100644 --- a/runtime/onert/core/src/ir/operation/Pool2D.cc +++ b/runtime/onert/core/src/ir/operation/Pool2D.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/Pool2D.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -32,7 +30,7 @@ void Pool2D::accept(OperationVisitor &v) const { v.visit(*this); } Pool2D::Pool2D(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } @@ -40,9 +38,9 @@ std::string Pool2D::name() const { using PoolType = onert::ir::operation::Pool2D::PoolType; static const std::unordered_map<PoolType, std::string> name_map{ - {PoolType::AVG, "Avg" + std::string{toString(opcode())}}, - {PoolType::L2, "L2" + std::string{toString(opcode())}}, - {PoolType::MAX, "Max" + std::string{toString(opcode())}}}; + {PoolType::AVG, "Avg" + std::string{toString(opcode())}}, + {PoolType::L2, "L2" + std::string{toString(opcode())}}, + {PoolType::MAX, "Max" + std::string{toString(opcode())}}}; return name_map.at(_param.op_type); } diff --git a/runtime/onert/core/src/ir/operation/Pow.cc b/runtime/onert/core/src/ir/operation/Pow.cc index 940b1391a..f7c159a12 100644 --- a/runtime/onert/core/src/ir/operation/Pow.cc +++ b/runtime/onert/core/src/ir/operation/Pow.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Pow.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Pow::accept(OperationVisitor &v) const { v.visit(*this); } Pow::Pow(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/RNN.cc b/runtime/onert/core/src/ir/operation/RNN.cc index 298c5e745..988a50669 100644 --- a/runtime/onert/core/src/ir/operation/RNN.cc +++ b/runtime/onert/core/src/ir/operation/RNN.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/RNN.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void RNN::accept(OperationVisitor &v) const { v.visit(*this); } RNN::RNN(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(5u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(5u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Range.cc b/runtime/onert/core/src/ir/operation/Range.cc index 96ab04c1b..8ced92a0b 100644 --- a/runtime/onert/core/src/ir/operation/Range.cc +++ b/runtime/onert/core/src/ir/operation/Range.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Range.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Range::accept(OperationVisitor &v) const { v.visit(*this); } Range::Range(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Rank.cc b/runtime/onert/core/src/ir/operation/Rank.cc index c357e9018..40797bf29 100644 --- a/runtime/onert/core/src/ir/operation/Rank.cc +++ b/runtime/onert/core/src/ir/operation/Rank.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Rank.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Rank::accept(OperationVisitor &v) const { v.visit(*this); } Rank::Rank(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(1u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Reduce.cc b/runtime/onert/core/src/ir/operation/Reduce.cc index d6a1d953c..8da1940fa 100644 --- a/runtime/onert/core/src/ir/operation/Reduce.cc +++ b/runtime/onert/core/src/ir/operation/Reduce.cc @@ -15,12 +15,10 @@ */ #include "ir/operation/Reduce.h" +#include "ir/OperationVisitor.h" -#include <cassert> #include <unordered_map> -#include "ir/OperationVisitor.h" - namespace onert { namespace ir @@ -32,7 +30,7 @@ void Reduce::accept(OperationVisitor &v) const { v.visit(*this); } Reduce::Reduce(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } @@ -40,13 +38,13 @@ std::string Reduce::name() const { using ReduceType = onert::ir::operation::Reduce::ReduceType; static const std::unordered_map<ReduceType, std::string> name_map{ - {ReduceType::ALL, std::string{toString(opcode())} + "All"}, - {ReduceType::ANY, std::string{toString(opcode())} + "Any"}, - {ReduceType::MAX, std::string{toString(opcode())} + "Max"}, - {ReduceType::MEAN, std::string{toString(opcode())} + "Mean"}, - {ReduceType::MIN, std::string{toString(opcode())} + "Min"}, - {ReduceType::PROD, std::string{toString(opcode())} + "Prod"}, - {ReduceType::SUM, std::string{toString(opcode())} + "SUM"}}; + {ReduceType::ALL, std::string{toString(opcode())} + "All"}, + {ReduceType::ANY, std::string{toString(opcode())} + "Any"}, + {ReduceType::MAX, std::string{toString(opcode())} + "Max"}, + {ReduceType::MEAN, std::string{toString(opcode())} + "Mean"}, + {ReduceType::MIN, std::string{toString(opcode())} + "Min"}, + {ReduceType::PROD, std::string{toString(opcode())} + "Prod"}, + {ReduceType::SUM, std::string{toString(opcode())} + "SUM"}}; return name_map.at(_param.reduce_type); // return std::string(toString(opcode())) + reduce_type_str_map.at(_param.reduce_type); } diff --git a/runtime/onert/core/src/ir/operation/Reshape.cc b/runtime/onert/core/src/ir/operation/Reshape.cc index 92aa89ac6..0ed4affa1 100644 --- a/runtime/onert/core/src/ir/operation/Reshape.cc +++ b/runtime/onert/core/src/ir/operation/Reshape.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Reshape.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Reshape::accept(OperationVisitor &v) const { v.visit(*this); } Reshape::Reshape(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param(param) + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param(param) { } diff --git a/runtime/onert/core/src/ir/operation/ResizeBilinear.cc b/runtime/onert/core/src/ir/operation/ResizeBilinear.cc index d0d89f45f..7d256f447 100644 --- a/runtime/onert/core/src/ir/operation/ResizeBilinear.cc +++ b/runtime/onert/core/src/ir/operation/ResizeBilinear.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/ResizeBilinear.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void ResizeBilinear::accept(OperationVisitor &v) const { v.visit(*this); } ResizeBilinear::ResizeBilinear(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createInRange(1u, 2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/ResizeNearestNeighbor.cc b/runtime/onert/core/src/ir/operation/ResizeNearestNeighbor.cc index 9f17af97c..58be87b95 100644 --- a/runtime/onert/core/src/ir/operation/ResizeNearestNeighbor.cc +++ b/runtime/onert/core/src/ir/operation/ResizeNearestNeighbor.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/ResizeNearestNeighbor.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -32,7 +29,7 @@ void ResizeNearestNeighbor::accept(OperationVisitor &v) const { v.visit(*this); ResizeNearestNeighbor::ResizeNearestNeighbor(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createInRange(1u, 2u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Reverse.cc b/runtime/onert/core/src/ir/operation/Reverse.cc index 4b3c1e1af..6c3746426 100644 --- a/runtime/onert/core/src/ir/operation/Reverse.cc +++ b/runtime/onert/core/src/ir/operation/Reverse.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Reverse.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Reverse::accept(OperationVisitor &v) const { v.visit(*this); } Reverse::Reverse(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Select.cc b/runtime/onert/core/src/ir/operation/Select.cc index 1f22b5234..59684190c 100644 --- a/runtime/onert/core/src/ir/operation/Select.cc +++ b/runtime/onert/core/src/ir/operation/Select.cc @@ -28,7 +28,7 @@ namespace operation void Select::accept(OperationVisitor &v) const { v.visit(*this); } Select::Select(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Shape.cc b/runtime/onert/core/src/ir/operation/Shape.cc index 2a63d6dcf..f90924488 100644 --- a/runtime/onert/core/src/ir/operation/Shape.cc +++ b/runtime/onert/core/src/ir/operation/Shape.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Shape.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Shape::accept(OperationVisitor &v) const { v.visit(*this); } Shape::Shape(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(1u), inputs, outputs} + : Operation{OperandConstraint::createExact(1u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Slice.cc b/runtime/onert/core/src/ir/operation/Slice.cc index 888b563fb..1362c0f91 100644 --- a/runtime/onert/core/src/ir/operation/Slice.cc +++ b/runtime/onert/core/src/ir/operation/Slice.cc @@ -27,7 +27,7 @@ namespace operation void Slice::accept(OperationVisitor &v) const { v.visit(*this); } Slice::Slice(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Softmax.cc b/runtime/onert/core/src/ir/operation/Softmax.cc index 3f1aa0af1..c06c85309 100644 --- a/runtime/onert/core/src/ir/operation/Softmax.cc +++ b/runtime/onert/core/src/ir/operation/Softmax.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Softmax.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void Softmax::accept(OperationVisitor &v) const { v.visit(*this); } Softmax::Softmax(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/SpaceToBatchND.cc b/runtime/onert/core/src/ir/operation/SpaceToBatchND.cc index 53fab4fa9..94acccb0c 100644 --- a/runtime/onert/core/src/ir/operation/SpaceToBatchND.cc +++ b/runtime/onert/core/src/ir/operation/SpaceToBatchND.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/SpaceToBatchND.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void SpaceToBatchND::accept(OperationVisitor &v) const { v.visit(*this); } SpaceToBatchND::SpaceToBatchND(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(3u), inputs, outputs} + : Operation{OperandConstraint::createExact(3u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/SpaceToDepth.cc b/runtime/onert/core/src/ir/operation/SpaceToDepth.cc index d8a45aee5..08e7e5190 100644 --- a/runtime/onert/core/src/ir/operation/SpaceToDepth.cc +++ b/runtime/onert/core/src/ir/operation/SpaceToDepth.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/SpaceToDepth.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void SpaceToDepth::accept(OperationVisitor &v) const { v.visit(*this); } SpaceToDepth::SpaceToDepth(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Split.cc b/runtime/onert/core/src/ir/operation/Split.cc index 244884e41..3e371188d 100644 --- a/runtime/onert/core/src/ir/operation/Split.cc +++ b/runtime/onert/core/src/ir/operation/Split.cc @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "ir/operation/Split.h" -#include <cassert> #include "ir/OperationVisitor.h" + namespace onert { namespace ir @@ -25,7 +26,7 @@ namespace operation void Split::accept(OperationVisitor &v) const { v.visit(*this); } Split::Split(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} { } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/SplitV.cc b/runtime/onert/core/src/ir/operation/SplitV.cc index e638c9ac9..be13f167e 100644 --- a/runtime/onert/core/src/ir/operation/SplitV.cc +++ b/runtime/onert/core/src/ir/operation/SplitV.cc @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "ir/operation/SplitV.h" -#include <cassert> #include "ir/OperationVisitor.h" + namespace onert { namespace ir @@ -25,7 +26,7 @@ namespace operation void SplitV::accept(OperationVisitor &v) const { v.visit(*this); } SplitV::SplitV(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} { } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/SquaredDifference.cc b/runtime/onert/core/src/ir/operation/SquaredDifference.cc index 49e58aaf2..db93903c7 100644 --- a/runtime/onert/core/src/ir/operation/SquaredDifference.cc +++ b/runtime/onert/core/src/ir/operation/SquaredDifference.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/SquaredDifference.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void SquaredDifference::accept(OperationVisitor &v) const { v.visit(*this); } SquaredDifference::SquaredDifference(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/Squeeze.cc b/runtime/onert/core/src/ir/operation/Squeeze.cc index 8cf928fb4..e059c4bee 100644 --- a/runtime/onert/core/src/ir/operation/Squeeze.cc +++ b/runtime/onert/core/src/ir/operation/Squeeze.cc @@ -28,7 +28,7 @@ void Squeeze::accept(OperationVisitor &v) const { v.visit(*this); } Squeeze::Squeeze(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param(param) + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param(param) { } diff --git a/runtime/onert/core/src/ir/operation/StatelessRandomUniform.cc b/runtime/onert/core/src/ir/operation/StatelessRandomUniform.cc index cbb0ff251..94be0be86 100644 --- a/runtime/onert/core/src/ir/operation/StatelessRandomUniform.cc +++ b/runtime/onert/core/src/ir/operation/StatelessRandomUniform.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/StatelessRandomUniform.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ void StatelessRandomUniform::accept(OperationVisitor &v) const { v.visit(*this); StatelessRandomUniform::StatelessRandomUniform(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/StridedSlice.cc b/runtime/onert/core/src/ir/operation/StridedSlice.cc index 2a7905995..a38282c93 100644 --- a/runtime/onert/core/src/ir/operation/StridedSlice.cc +++ b/runtime/onert/core/src/ir/operation/StridedSlice.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/StridedSlice.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void StridedSlice::accept(OperationVisitor &v) const { v.visit(*this); } StridedSlice::StridedSlice(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(4u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Tile.cc b/runtime/onert/core/src/ir/operation/Tile.cc index 5ba3df2ad..51c1ff1dc 100644 --- a/runtime/onert/core/src/ir/operation/Tile.cc +++ b/runtime/onert/core/src/ir/operation/Tile.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Tile.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -30,7 +27,7 @@ namespace operation void Tile::accept(OperationVisitor &v) const { v.visit(*this); } Tile::Tile(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) - : Operation{OperandConstraint::createExact(2u), inputs, outputs} + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/TopKV2.cc b/runtime/onert/core/src/ir/operation/TopKV2.cc index a5e6c6a85..e1723d180 100644 --- a/runtime/onert/core/src/ir/operation/TopKV2.cc +++ b/runtime/onert/core/src/ir/operation/TopKV2.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/TopKV2.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void TopKV2::accept(OperationVisitor &v) const { v.visit(*this); } TopKV2::TopKV2(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Transpose.cc b/runtime/onert/core/src/ir/operation/Transpose.cc index 3a663fbce..dbc5ef2aa 100644 --- a/runtime/onert/core/src/ir/operation/Transpose.cc +++ b/runtime/onert/core/src/ir/operation/Transpose.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/Transpose.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -29,9 +26,8 @@ namespace operation void Transpose::accept(OperationVisitor &v) const { v.visit(*this); } -Transpose::Transpose(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, - const Param ¶m) - : Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +Transpose::Transpose(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : Operation{OperandConstraint::createExact(2u), inputs, outputs} { } diff --git a/runtime/onert/core/src/ir/operation/TransposeConv.cc b/runtime/onert/core/src/ir/operation/TransposeConv.cc index 7f29ca44e..944cc365d 100644 --- a/runtime/onert/core/src/ir/operation/TransposeConv.cc +++ b/runtime/onert/core/src/ir/operation/TransposeConv.cc @@ -15,9 +15,6 @@ */ #include "ir/operation/TransposeConv.h" - -#include <cassert> - #include "ir/OperationVisitor.h" namespace onert @@ -31,7 +28,7 @@ void TransposeConv::accept(OperationVisitor &v) const { v.visit(*this); } TransposeConv::TransposeConv(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} { } diff --git a/runtime/onert/core/src/ir/operation/Unpack.cc b/runtime/onert/core/src/ir/operation/Unpack.cc index 67aa54ab5..185eddce3 100644 --- a/runtime/onert/core/src/ir/operation/Unpack.cc +++ b/runtime/onert/core/src/ir/operation/Unpack.cc @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "ir/operation/Unpack.h" #include "ir/OperationVisitor.h" @@ -25,7 +26,7 @@ namespace operation void Unpack::accept(OperationVisitor &v) const { v.visit(*this); } Unpack::Unpack(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} { } } // namespace operation diff --git a/runtime/onert/core/src/ir/operation/While.cc b/runtime/onert/core/src/ir/operation/While.cc index 2505c60e3..f35996b07 100644 --- a/runtime/onert/core/src/ir/operation/While.cc +++ b/runtime/onert/core/src/ir/operation/While.cc @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include "ir/operation/While.h" #include "ir/OperationVisitor.h" @@ -25,7 +26,7 @@ namespace operation void While::accept(OperationVisitor &v) const { v.visit(*this); } While::While(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, const Param ¶m) - : Operation{OperandConstraint::createAny(), inputs, outputs}, _param{param} + : Operation{OperandConstraint::createAny(), inputs, outputs}, _param{param} { } } // namespace operation |