diff options
Diffstat (limited to 'runtimes/neurun/core/src/model')
68 files changed, 2907 insertions, 0 deletions
diff --git a/runtimes/neurun/core/src/model/LayoutSet.cc b/runtimes/neurun/core/src/model/LayoutSet.cc new file mode 100644 index 000000000..fec6138a7 --- /dev/null +++ b/runtimes/neurun/core/src/model/LayoutSet.cc @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2018 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 "LayoutSet.h" + +namespace neurun +{ +namespace model +{ + +LayoutSet::LayoutSet(std::initializer_list<Layout> layouts) +{ + for (auto layout : layouts) + { + _set.insert(layout); + } +} + +LayoutSet LayoutSet::operator|(const LayoutSet &other) const +{ + auto ret = *this; + for (auto layout : other) + { + ret.add(layout); + } + return ret; +} + +LayoutSet LayoutSet::operator&(const LayoutSet &other) const +{ + LayoutSet ret; + for (auto layout : other) + { + if (contains(layout)) + { + ret.add(layout); + } + } + return ret; +} + +LayoutSet LayoutSet::operator-(const LayoutSet &other) const +{ + auto ret = *this; + for (auto layout : other) + { + ret.remove(layout); + } + return ret; +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/LayoutSet.h b/runtimes/neurun/core/src/model/LayoutSet.h new file mode 100644 index 000000000..be75c8ee5 --- /dev/null +++ b/runtimes/neurun/core/src/model/LayoutSet.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 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. + */ + +#ifndef __NEURUN_GRAPH_OPERAND_LAYOUT_SET_H__ +#define __NEURUN_GRAPH_OPERAND_LAYOUT_SET_H__ + +#include <initializer_list> +#include <unordered_set> + +#include "model/Layout.h" + +namespace neurun +{ +namespace model +{ + +class LayoutSet +{ +public: + LayoutSet() = default; + LayoutSet(std::initializer_list<Layout> layouts); + +public: + void add(const Layout &layout) { _set.insert(layout); } + void remove(const Layout &layout) { _set.erase(layout); } + uint32_t size() const { return static_cast<uint32_t>(_set.size()); } + bool contains(const Layout &layout) const { return _set.find(layout) != _set.end(); } + +public: + LayoutSet operator|(const LayoutSet &other) const; // Union + LayoutSet operator&(const LayoutSet &other) const; // Intersect + LayoutSet operator-(const LayoutSet &other) const; // Minus + +public: + std::unordered_set<Layout>::const_iterator begin() const { return _set.begin(); } + std::unordered_set<Layout>::const_iterator end() const { return _set.end(); } + +private: + std::unordered_set<Layout> _set; +}; + +} // namespace model +} // namespace neurun + +#endif // __NEURUN_GRAPH_OPERAND_LAYOUT_SET_H__ diff --git a/runtimes/neurun/core/src/model/Operand.cc b/runtimes/neurun/core/src/model/Operand.cc new file mode 100644 index 000000000..4d72fac8c --- /dev/null +++ b/runtimes/neurun/core/src/model/Operand.cc @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2018 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 "model/Operand.h" + +namespace neurun +{ +namespace model +{ + +size_t Operand::operandSize(void) const +{ + const uint32_t ranks = shape().rank(); + int32_t elements = 1; + + for (uint32_t rank = 0; rank < ranks; rank++) + { + elements *= shape().dim(rank); + } + + DataType type = typeInfo().type(); + size_t element_size = sizeOfDataType(type); + + // Value of type is matched with OperandCode enum in NeuralNetworks.h + return element_size * elements; +} + +void Operand::appendUse(const ::neurun::model::OperationIndex &idx) +{ + assert(!_uses.contains(idx)); + + _uses.append(idx); +} + +void Operand::removeUse(const ::neurun::model::OperationIndex &idx) +{ + assert(_uses.contains(idx)); + + _uses.remove(idx); +} + +void Operand::appendDef(const ::neurun::model::OperationIndex &idx) +{ + assert(!isConstant()); + assert(_def.size() == 0); + + _def.append(idx); +} + +void Operand::removeDef(const ::neurun::model::OperationIndex &idx) +{ + assert(_def.contains(idx)); + + _def.remove(idx); +} + +void Operand::parent_info(std::unique_ptr<graph::operand::ParentInfo> &&parent_info) +{ + _parent_info = std::move(parent_info); +} + +const graph::operand::ParentInfo *Operand::parent_info() const { return _parent_info.get(); } + +graph::operand::ParentInfo *Operand::parent_info() { return _parent_info.get(); } + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/OperandConstraint.cc b/runtimes/neurun/core/src/model/OperandConstraint.cc new file mode 100644 index 000000000..2730f712a --- /dev/null +++ b/runtimes/neurun/core/src/model/OperandConstraint.cc @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2018 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 "model/OperandConstraint.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/OperandIndexSequence.cc b/runtimes/neurun/core/src/model/OperandIndexSequence.cc new file mode 100644 index 000000000..a9454df24 --- /dev/null +++ b/runtimes/neurun/core/src/model/OperandIndexSequence.cc @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2018 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 "model/OperandIndexSequence.h" + +#include <algorithm> + +namespace neurun +{ +namespace model +{ + +OperandIndexSequence::OperandIndexSequence(std::initializer_list<OperandIndex> list) : _set(list) +{ + // DO NOTHING +} + +OperandIndexSequence::OperandIndexSequence(std::initializer_list<int32_t> list) +{ + for (auto val : list) + { + _set.emplace_back(static_cast<uint32_t>(val)); + } +} + +OperandIndexSequence::OperandIndexSequence(std::initializer_list<uint32_t> list) +{ + for (auto val : list) + { + _set.emplace_back(val); + } +} + +bool OperandIndexSequence::contains(const OperandIndex &index) const +{ + return std::find(_set.begin(), _set.end(), index) != _set.end(); +} + +void OperandIndexSequence::replace(const OperandIndex &from, const OperandIndex &to) +{ + std::replace(_set.begin(), _set.end(), from, to); +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/Operation.cc b/runtimes/neurun/core/src/model/Operation.cc new file mode 100644 index 000000000..fc1bd599e --- /dev/null +++ b/runtimes/neurun/core/src/model/Operation.cc @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018 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 "model/Operation.h" + +#include <cassert> + +#include "graph/operation/LowerInfo.h" + +namespace neurun +{ +namespace model +{ + +Operation::Operation(OperandConstraint input_constr, const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : _input_constr{input_constr}, _inputs{inputs}, _outputs{outputs} +{ +} + +Operation::Operation(OperandConstraint input_constr) : _input_constr{input_constr} {} + +Operation::~Operation() = default; + +void Operation::setInputs(const OperandIndexSequence &indexes) +{ + assert(_input_constr.check(indexes.size())); + _inputs = indexes; +} + +void Operation::setOutputs(const OperandIndexSequence &indexes) { _outputs = indexes; } + +void Operation::replaceInput(const OperandIndex &from, const OperandIndex &to) +{ + _inputs.replace(from, to); +} + +void Operation::replaceOutput(const OperandIndex &from, const OperandIndex &to) +{ + _outputs.replace(from, to); +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/OperationIndexList.cc b/runtimes/neurun/core/src/model/OperationIndexList.cc new file mode 100644 index 000000000..e2c077ed4 --- /dev/null +++ b/runtimes/neurun/core/src/model/OperationIndexList.cc @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2018 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 "model/OperationIndexList.h" + +#include <algorithm> + +namespace neurun +{ +namespace model +{ + +OperationIndexList::OperationIndexList(std::initializer_list<OperationIndex> list) : _list(list) +{ + // DO NOTHING +} + +bool OperationIndexList::contains(const ::neurun::model::OperationIndex &index) const +{ + return std::find(_list.begin(), _list.end(), index) != _list.end(); +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/Shape.cc b/runtimes/neurun/core/src/model/Shape.cc new file mode 100644 index 000000000..b7f7bff68 --- /dev/null +++ b/runtimes/neurun/core/src/model/Shape.cc @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2018 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 "model/Shape.h" +#include "util/Utils.h" + +#include <cassert> +#include <functional> +#include <numeric> + +namespace neurun +{ +namespace model +{ + +FeatureShape Shape::asFeature(Layout layout) const +{ + assert(rank() == 4); + assert(layout == Layout::NHWC || layout == Layout::NCHW); + + if (layout == Layout::NHWC) + { + // Feature Map in NHWC layout + // - Dimension(0) -> Batch + // - Dimension(1) -> Height + // - Dimension(2) -> Width + // - Dimension(3) -> Depth + const auto batch = dim(0); + const auto depth = dim(3); + const auto height = dim(1); + const auto width = dim(2); + + return {batch, depth, height, width}; + } + else if (layout == Layout::NCHW) + { + // Feature Map in NHWC layout + // - Dimension(0) -> Batch + // - Dimension(1) -> Depth + // - Dimension(2) -> Height + // - Dimension(3) -> Width + const auto batch = dim(0); + const auto depth = dim(1); + const auto height = dim(2); + const auto width = dim(3); + + return {batch, depth, height, width}; + } + else + { + throw std::runtime_error("Wrong Layout"); + } +} + +// Extended dimension is filled with 1. +void Shape::extendRank(int to_rank) +{ + assert(to_rank - rank() >= 0); + _dimensions.insert(_dimensions.cbegin(), to_rank - rank(), 1); +} + +uint64_t Shape::num_elements() const +{ + // All of the nodes must have non-negative dimension + assert(std::all_of(_dimensions.begin(), _dimensions.end(), + [](const int32_t &v) { return (v >= 0); })); + + return std::accumulate(_dimensions.cbegin(), _dimensions.cend(), UINT64_C(1), + std::multiplies<uint64_t>()); +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/Subgraph.cc b/runtimes/neurun/core/src/model/Subgraph.cc new file mode 100644 index 000000000..4b8402720 --- /dev/null +++ b/runtimes/neurun/core/src/model/Subgraph.cc @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2019 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 "model/Subgraph.h" +#include "model/OperationVisitor.h" +#include <sstream> + +namespace neurun +{ +namespace model +{ + +Subgraph::Subgraph(Layout layout) : Operation{OperandConstraint::createAny()}, _layout{layout} +{ + // DO NOTHING +} + +void Subgraph::accept(OperationVisitor &v) const { v.visit(*this); } + +// TODO: Impl Dumper instead of this method +std::string Subgraph::getStr() const +{ + // " subgraph IN(xx,xx,xx) -> { op0, op1, op2 } -> OUT(yy,yy,yy)" + std::stringstream ss; + ss << " subgraph IN("; + for (const auto &index : getInputs()) + { + ss << " " << index.value(); + } + ss << " ) -> {"; + for (const auto &elem : _operations) + { + ss << " " << elem.index.value() << "(" << elem.node->getName() << ")"; + } + ss << " } -> OUT("; + for (const auto &index : getOutputs()) + { + ss << " " << index.value(); + } + ss << " )"; + return ss.str(); +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/Subgraphs.cc b/runtimes/neurun/core/src/model/Subgraphs.cc new file mode 100644 index 000000000..64d806dfa --- /dev/null +++ b/runtimes/neurun/core/src/model/Subgraphs.cc @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2019 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 "model/Subgraphs.h" +#include "util/logging.h" +#include "cpp14/memory.h" + +#include <cassert> +#include <string> + +namespace neurun +{ +namespace model +{ + +SubgraphIndex Subgraphs::emplace(const OperationIndex &index, const Operation &node, Layout layout) +{ + std::unique_ptr<Subgraph> subg = nnfw::cpp14::make_unique<model::Subgraph>(layout); + subg->appendOperation(index, node); + return push(std::move(subg)); +} + +SubgraphIndex Subgraphs::emplace(std::unique_ptr<Subgraph> &&subg) { return push(std::move(subg)); } + +bool Subgraphs::containsOperation(const OperationIndex &operation_index) const +{ + return findOperation(operation_index).valid(); +} + +SubgraphIndex Subgraphs::getOperation(const OperationIndex &operation_index) const +{ + SubgraphIndex ret = findOperation(operation_index); + assert(ret.valid()); + return ret; +} + +// TODO: Extract this into external helper function +void Subgraphs::dump(const std::string &msg) const +{ + VERBOSE(Subgraphs) << "Subgraphs(" << msg << ")" << std::endl; + iterate([&](const SubgraphIndex &idx, const model::Subgraph &subg) { + VERBOSE(Subgraphs) << idx.value() << "] " << subg.getStr() << std::endl; + }); +} + +SubgraphIndex Subgraphs::findOperation(const OperationIndex &operation_index) const +{ + SubgraphIndex ret; + iterate([&](const SubgraphIndex &index, const Subgraph &object) { + for (const auto &elem : object.operations()) + { + if (elem.index == operation_index) + ret = index; + } + }); + return ret; +} + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/TypeInfo.cc b/runtimes/neurun/core/src/model/TypeInfo.cc new file mode 100644 index 000000000..46ac2d4de --- /dev/null +++ b/runtimes/neurun/core/src/model/TypeInfo.cc @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019 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 "model/TypeInfo.h" + +namespace neurun +{ +namespace model +{ + +bool operator==(const TypeInfo &lhs, const TypeInfo &rhs) +{ + if (lhs.type() != rhs.type()) + { + return false; + } + + if (lhs.offset() != rhs.offset()) + { + return false; + } + + if (lhs.scale() != rhs.scale()) + { + return false; + } + + return true; +} + +bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs) { return !(lhs == rhs); } + +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/AbsNode.cc b/runtimes/neurun/core/src/model/operation/AbsNode.cc new file mode 100644 index 000000000..dd9566da9 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/AbsNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/AbsNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void AbsNode::accept(OperationVisitor &v) const { v.visit(*this); } + +AbsNode::AbsNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/AddNode.cc b/runtimes/neurun/core/src/model/operation/AddNode.cc new file mode 100644 index 000000000..43ad7241f --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/AddNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/AddNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void AddNode::accept(OperationVisitor &v) const { v.visit(*this); } + +AddNode::AddNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ArgMaxNode.cc b/runtimes/neurun/core/src/model/operation/ArgMaxNode.cc new file mode 100644 index 000000000..2486f54b0 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ArgMaxNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ArgMaxNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ArgMaxNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ArgMaxNode::ArgMaxNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/AvgPool2DNode.cc b/runtimes/neurun/core/src/model/operation/AvgPool2DNode.cc new file mode 100644 index 000000000..4c625f973 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/AvgPool2DNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/AvgPool2DNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void AvgPool2DNode::accept(OperationVisitor &v) const { v.visit(*this); } + +AvgPool2DNode::AvgPool2DNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/CastNode.cc b/runtimes/neurun/core/src/model/operation/CastNode.cc new file mode 100644 index 000000000..85d11e3d1 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/CastNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/CastNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void CastNode::accept(OperationVisitor &v) const { v.visit(*this); } + +CastNode::CastNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ComparisonNode.cc b/runtimes/neurun/core/src/model/operation/ComparisonNode.cc new file mode 100644 index 000000000..598e61969 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ComparisonNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ComparisonNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ComparisonNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ComparisonNode::ComparisonNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ConcatNode.cc b/runtimes/neurun/core/src/model/operation/ConcatNode.cc new file mode 100644 index 000000000..195952637 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ConcatNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/ConcatNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ConcatNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ConcatNode::ConcatNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createAtLeast(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/Conv2DNode.cc b/runtimes/neurun/core/src/model/operation/Conv2DNode.cc new file mode 100644 index 000000000..218c5d193 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/Conv2DNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/Conv2DNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void Conv2DNode::accept(OperationVisitor &v) const { v.visit(*this); } + +Conv2DNode::Conv2DNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/CustomNode.cc b/runtimes/neurun/core/src/model/operation/CustomNode.cc new file mode 100644 index 000000000..059786218 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/CustomNode.cc @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019 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 "model/operation/CustomNode.h" + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void CustomNode::accept(OperationVisitor &v) const { v.visit(*this); } + +CustomNode::CustomNode(OperandConstraint input_constr, const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, std::string id, + const Userdata &userdata) + : model::Operation{input_constr, inputs, outputs}, _id(std::move(id)), _userdata(userdata) +{ +} + +const std::string &CustomNode::id() const { return _id; } + +const CustomNode::Userdata &CustomNode::userdata() const { return _userdata; } + +CustomNode::~CustomNode() { delete[] _userdata.data; } + +std::string CustomNode::getName() const { return id(); } + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/DepthToSpaceNode.cc b/runtimes/neurun/core/src/model/operation/DepthToSpaceNode.cc new file mode 100644 index 000000000..ec3e5433e --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/DepthToSpaceNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/DepthToSpaceNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void DepthToSpaceNode::accept(OperationVisitor &v) const { v.visit(*this); } + +DepthToSpaceNode::DepthToSpaceNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/DepthwiseConv2DNode.cc b/runtimes/neurun/core/src/model/operation/DepthwiseConv2DNode.cc new file mode 100644 index 000000000..70d107aa7 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/DepthwiseConv2DNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/DepthwiseConv2DNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void DepthwiseConv2DNode::accept(OperationVisitor &v) const { v.visit(*this); } + +DepthwiseConv2DNode::DepthwiseConv2DNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/DequantizeNode.cc b/runtimes/neurun/core/src/model/operation/DequantizeNode.cc new file mode 100644 index 000000000..634d36b26 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/DequantizeNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/DequantizeNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void DequantizeNode::accept(OperationVisitor &v) const { v.visit(*this); } + +DequantizeNode::DequantizeNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/DivNode.cc b/runtimes/neurun/core/src/model/operation/DivNode.cc new file mode 100644 index 000000000..814491aa7 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/DivNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/DivNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void DivNode::accept(OperationVisitor &v) const { v.visit(*this); } + +DivNode::DivNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/EmbeddingLookupNode.cc b/runtimes/neurun/core/src/model/operation/EmbeddingLookupNode.cc new file mode 100644 index 000000000..d49ca19b1 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/EmbeddingLookupNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/EmbeddingLookupNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void EmbeddingLookupNode::accept(OperationVisitor &v) const { v.visit(*this); } + +EmbeddingLookupNode::EmbeddingLookupNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ExpNode.cc b/runtimes/neurun/core/src/model/operation/ExpNode.cc new file mode 100644 index 000000000..3f420f8b5 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ExpNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/ExpNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ExpNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ExpNode::ExpNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/FloorNode.cc b/runtimes/neurun/core/src/model/operation/FloorNode.cc new file mode 100644 index 000000000..47b56fbaa --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/FloorNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/FloorNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void FloorNode::accept(OperationVisitor &v) const { v.visit(*this); } + +FloorNode::FloorNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/FullyConnectedNode.cc b/runtimes/neurun/core/src/model/operation/FullyConnectedNode.cc new file mode 100644 index 000000000..42f18c72d --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/FullyConnectedNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/FullyConnectedNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void FullyConnectedNode::accept(OperationVisitor &v) const { v.visit(*this); } + +FullyConnectedNode::FullyConnectedNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/GatherNode.cc b/runtimes/neurun/core/src/model/operation/GatherNode.cc new file mode 100644 index 000000000..1ecb6f8ec --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/GatherNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/GatherNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void GatherNode::accept(OperationVisitor &v) const { v.visit(*this); } + +GatherNode::GatherNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/HashtableLookupNode.cc b/runtimes/neurun/core/src/model/operation/HashtableLookupNode.cc new file mode 100644 index 000000000..d2c144e71 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/HashtableLookupNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/HashtableLookupNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void HashtableLookupNode::accept(OperationVisitor &v) const { v.visit(*this); } + +HashtableLookupNode::HashtableLookupNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(3u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/L2NormalizationNode.cc b/runtimes/neurun/core/src/model/operation/L2NormalizationNode.cc new file mode 100644 index 000000000..1169785c6 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/L2NormalizationNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/L2NormalizationNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void L2NormalizationNode::accept(OperationVisitor &v) const { v.visit(*this); } + +L2NormalizationNode::L2NormalizationNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/L2Pool2DNode.cc b/runtimes/neurun/core/src/model/operation/L2Pool2DNode.cc new file mode 100644 index 000000000..fb53f52c6 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/L2Pool2DNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/L2Pool2DNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void L2Pool2DNode::accept(OperationVisitor &v) const { v.visit(*this); } + +L2Pool2DNode::L2Pool2DNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LSTMNode.cc b/runtimes/neurun/core/src/model/operation/LSTMNode.cc new file mode 100644 index 000000000..31443e8ae --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LSTMNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/LSTMNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LSTMNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LSTMNode::LSTMNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(23u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LocalResponseNormalizationNode.cc b/runtimes/neurun/core/src/model/operation/LocalResponseNormalizationNode.cc new file mode 100644 index 000000000..4b1dded76 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LocalResponseNormalizationNode.cc @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019 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 "model/operation/LocalResponseNormalizationNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LocalResponseNormalizationNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LocalResponseNormalizationNode::LocalResponseNormalizationNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LogicalAndNode.cc b/runtimes/neurun/core/src/model/operation/LogicalAndNode.cc new file mode 100644 index 000000000..9e9a3dbbf --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LogicalAndNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/LogicalAndNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LogicalAndNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LogicalAndNode::LogicalAndNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LogicalNotNode.cc b/runtimes/neurun/core/src/model/operation/LogicalNotNode.cc new file mode 100644 index 000000000..1a3c324a5 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LogicalNotNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/LogicalNotNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LogicalNotNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LogicalNotNode::LogicalNotNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LogicalOrNode.cc b/runtimes/neurun/core/src/model/operation/LogicalOrNode.cc new file mode 100644 index 000000000..53fa305ae --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LogicalOrNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/LogicalOrNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LogicalOrNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LogicalOrNode::LogicalOrNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/LogisticNode.cc b/runtimes/neurun/core/src/model/operation/LogisticNode.cc new file mode 100644 index 000000000..358ce6acd --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/LogisticNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/LogisticNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void LogisticNode::accept(OperationVisitor &v) const { v.visit(*this); } + +LogisticNode::LogisticNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/MaxPool2DNode.cc b/runtimes/neurun/core/src/model/operation/MaxPool2DNode.cc new file mode 100644 index 000000000..596aa2df9 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/MaxPool2DNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/MaxPool2DNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void MaxPool2DNode::accept(OperationVisitor &v) const { v.visit(*this); } + +MaxPool2DNode::MaxPool2DNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/MeanNode.cc b/runtimes/neurun/core/src/model/operation/MeanNode.cc new file mode 100644 index 000000000..22b23b27e --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/MeanNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/MeanNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void MeanNode::accept(OperationVisitor &v) const { v.visit(*this); } + +MeanNode::MeanNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/MulNode.cc b/runtimes/neurun/core/src/model/operation/MulNode.cc new file mode 100644 index 000000000..23a66848a --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/MulNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/MulNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void MulNode::accept(OperationVisitor &v) const { v.visit(*this); } + +MulNode::MulNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/NegNode.cc b/runtimes/neurun/core/src/model/operation/NegNode.cc new file mode 100644 index 000000000..6f3cf5a0a --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/NegNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/NegNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void NegNode::accept(OperationVisitor &v) const { v.visit(*this); } + +NegNode::NegNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/PReLUNode.cc b/runtimes/neurun/core/src/model/operation/PReLUNode.cc new file mode 100644 index 000000000..aa8aecdd5 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/PReLUNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/PReLUNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void PReLUNode::accept(OperationVisitor &v) const { v.visit(*this); } + +PReLUNode::PReLUNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/PadNode.cc b/runtimes/neurun/core/src/model/operation/PadNode.cc new file mode 100644 index 000000000..9947c9e71 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/PadNode.cc @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019 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 "model/operation/PadNode.h" + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void PadNode::accept(OperationVisitor &v) const { v.visit(*this); } + +PadNode::PadNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/PermuteNode.cc b/runtimes/neurun/core/src/model/operation/PermuteNode.cc new file mode 100644 index 000000000..8affca184 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/PermuteNode.cc @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2018 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 "model/operation/PermuteNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void PermuteNode::accept(OperationVisitor &v) const { v.visit(*this); } + +PermuteNode::PermuteNode(const OperandIndex &input, const OperandIndex &output, + const backend::BackendContext *input_backend_ctx, + const backend::BackendContext *output_backend_ctx, Type type, + model::DataType data_type) + : model::Operation{OperandConstraint::createExact(1u)}, + _param{input_backend_ctx, output_backend_ctx}, _type{type}, _dataType{data_type} +{ + setInputs({input}); + setOutputs({output}); +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/RNNNode.cc b/runtimes/neurun/core/src/model/operation/RNNNode.cc new file mode 100644 index 000000000..fa32059d0 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/RNNNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/RNNNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void RNNNode::accept(OperationVisitor &v) const { v.visit(*this); } + +RNNNode::RNNNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(5u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/RSQRTNode.cc b/runtimes/neurun/core/src/model/operation/RSQRTNode.cc new file mode 100644 index 000000000..faed11663 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/RSQRTNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/RSQRTNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void RSQRTNode::accept(OperationVisitor &v) const { v.visit(*this); } + +RSQRTNode::RSQRTNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReLU1Node.cc b/runtimes/neurun/core/src/model/operation/ReLU1Node.cc new file mode 100644 index 000000000..b1fe14e09 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReLU1Node.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReLU1Node.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReLU1Node::accept(OperationVisitor &v) const { v.visit(*this); } + +ReLU1Node::ReLU1Node(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReLU6Node.cc b/runtimes/neurun/core/src/model/operation/ReLU6Node.cc new file mode 100644 index 000000000..de7c35e1a --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReLU6Node.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReLU6Node.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReLU6Node::accept(OperationVisitor &v) const { v.visit(*this); } + +ReLU6Node::ReLU6Node(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReLUNode.cc b/runtimes/neurun/core/src/model/operation/ReLUNode.cc new file mode 100644 index 000000000..d79819d7f --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReLUNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReLUNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReLUNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ReLUNode::ReLUNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReduceMaxNode.cc b/runtimes/neurun/core/src/model/operation/ReduceMaxNode.cc new file mode 100644 index 000000000..486646ac9 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReduceMaxNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReduceMaxNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReduceMaxNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ReduceMaxNode::ReduceMaxNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReduceMinNode.cc b/runtimes/neurun/core/src/model/operation/ReduceMinNode.cc new file mode 100644 index 000000000..9f55251c4 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReduceMinNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReduceMinNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReduceMinNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ReduceMinNode::ReduceMinNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReduceSumNode.cc b/runtimes/neurun/core/src/model/operation/ReduceSumNode.cc new file mode 100644 index 000000000..5a06ef81b --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReduceSumNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ReduceSumNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReduceSumNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ReduceSumNode::ReduceSumNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ReshapeNode.cc b/runtimes/neurun/core/src/model/operation/ReshapeNode.cc new file mode 100644 index 000000000..cfd987ffb --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ReshapeNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018 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 "model/operation/ReshapeNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ReshapeNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ReshapeNode::ReshapeNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/ResizeBilinearNode.cc b/runtimes/neurun/core/src/model/operation/ResizeBilinearNode.cc new file mode 100644 index 000000000..263668a3c --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/ResizeBilinearNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/ResizeBilinearNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void ResizeBilinearNode::accept(OperationVisitor &v) const { v.visit(*this); } + +ResizeBilinearNode::ResizeBilinearNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SQRTNode.cc b/runtimes/neurun/core/src/model/operation/SQRTNode.cc new file mode 100644 index 000000000..835aa3f97 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SQRTNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/SQRTNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SQRTNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SQRTNode::SQRTNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SoftmaxNode.cc b/runtimes/neurun/core/src/model/operation/SoftmaxNode.cc new file mode 100644 index 000000000..39e6d2bd8 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SoftmaxNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 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 "model/operation/SoftmaxNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SoftmaxNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SoftmaxNode::SoftmaxNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SpaceToDepthNode.cc b/runtimes/neurun/core/src/model/operation/SpaceToDepthNode.cc new file mode 100644 index 000000000..2622881f4 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SpaceToDepthNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/SpaceToDepthNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SpaceToDepthNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SpaceToDepthNode::SpaceToDepthNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SplitNode.cc b/runtimes/neurun/core/src/model/operation/SplitNode.cc new file mode 100644 index 000000000..9a542f418 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SplitNode.cc @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019 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 "model/operation/SplitNode.h" +#include <cassert> +#include "model/OperationVisitor.h" +namespace neurun +{ +namespace model +{ +namespace operation +{ +void SplitNode::accept(OperationVisitor &v) const { v.visit(*this); } +SplitNode::SplitNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SquaredDifferenceNode.cc b/runtimes/neurun/core/src/model/operation/SquaredDifferenceNode.cc new file mode 100644 index 000000000..6672e08c1 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SquaredDifferenceNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/SquaredDifferenceNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SquaredDifferenceNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SquaredDifferenceNode::SquaredDifferenceNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SqueezeNode.cc b/runtimes/neurun/core/src/model/operation/SqueezeNode.cc new file mode 100644 index 000000000..1a82d65b3 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SqueezeNode.cc @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019 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 "model/operation/SqueezeNode.h" +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SqueezeNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SqueezeNode::SqueezeNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param(param) +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/StridedSliceNode.cc b/runtimes/neurun/core/src/model/operation/StridedSliceNode.cc new file mode 100644 index 000000000..9d60645a8 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/StridedSliceNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/StridedSliceNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void StridedSliceNode::accept(OperationVisitor &v) const { v.visit(*this); } + +StridedSliceNode::StridedSliceNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/SubNode.cc b/runtimes/neurun/core/src/model/operation/SubNode.cc new file mode 100644 index 000000000..6a64c4b76 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/SubNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/SubNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void SubNode::accept(OperationVisitor &v) const { v.visit(*this); } + +SubNode::SubNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/TanhNode.cc b/runtimes/neurun/core/src/model/operation/TanhNode.cc new file mode 100644 index 000000000..6372b4c73 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/TanhNode.cc @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2019 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 "model/operation/TanhNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void TanhNode::accept(OperationVisitor &v) const { v.visit(*this); } + +TanhNode::TanhNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/TopKV2Node.cc b/runtimes/neurun/core/src/model/operation/TopKV2Node.cc new file mode 100644 index 000000000..6ebcd50b3 --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/TopKV2Node.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/TopKV2Node.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void TopKV2Node::accept(OperationVisitor &v) const { v.visit(*this); } + +TopKV2Node::TopKV2Node(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/TransposeConvNode.cc b/runtimes/neurun/core/src/model/operation/TransposeConvNode.cc new file mode 100644 index 000000000..7ad2d1dca --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/TransposeConvNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/TransposeConvNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void TransposeConvNode::accept(OperationVisitor &v) const { v.visit(*this); } + +TransposeConvNode::TransposeConvNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(3u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/TransposeNode.cc b/runtimes/neurun/core/src/model/operation/TransposeNode.cc new file mode 100644 index 000000000..73542a04d --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/TransposeNode.cc @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2019 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 "model/operation/TransposeNode.h" + +#include <cassert> + +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ + +void TransposeNode::accept(OperationVisitor &v) const { v.visit(*this); } + +TransposeNode::TransposeNode(const OperandIndexSequence &inputs, + const OperandIndexSequence &outputs, const Param ¶m) + : model::Operation{OperandConstraint::createExact(2u), inputs, outputs}, _param{param} +{ +} + +} // namespace operation +} // namespace model +} // namespace neurun diff --git a/runtimes/neurun/core/src/model/operation/UnpackNode.cc b/runtimes/neurun/core/src/model/operation/UnpackNode.cc new file mode 100644 index 000000000..7717a017a --- /dev/null +++ b/runtimes/neurun/core/src/model/operation/UnpackNode.cc @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2019 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 "model/operation/UnpackNode.h" +#include "model/OperationVisitor.h" + +namespace neurun +{ +namespace model +{ +namespace operation +{ +void UnpackNode::accept(OperationVisitor &v) const { v.visit(*this); } +UnpackNode::UnpackNode(const OperandIndexSequence &inputs, const OperandIndexSequence &outputs, + const Param ¶m) + : model::Operation{OperandConstraint::createExact(1u), inputs, outputs}, _param{param} +{ +} +} // namespace operation +} // namespace model +} // namespace neurun |