diff options
Diffstat (limited to 'runtimes/neurun/src/graph/operation')
29 files changed, 4 insertions, 1584 deletions
diff --git a/runtimes/neurun/src/graph/operation/AvgPool2D.cc b/runtimes/neurun/src/graph/operation/AvgPool2D.cc deleted file mode 100644 index b2612c6b5..000000000 --- a/runtimes/neurun/src/graph/operation/AvgPool2D.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 "AvgPool2D.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace AvgPool2D -{ -namespace Implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 7); - assert(init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // 0 -> IFM Tensor Index - // 1 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 2 -> Horizontal (over width) Stride Index - // 3 -> Vertial (over height) Stride Index - // 4 -> Filter Width Index - // 5 -> Filter Height Index - // 6 -> FuseCode (activation) Index - - setInputs({init_param.inputs[0]}); - setOutputs({init_param.outputs[0]}); - - _param.padding_index = init_param.inputs[1]; - _param.hstride_index = init_param.inputs[2]; - _param.vstride_index = init_param.inputs[3]; - - _param.kw_index = init_param.inputs[4]; - _param.kh_index = init_param.inputs[5]; - _param.activation_index = init_param.inputs[6]; -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Implicit -} // namespace AvgPool2D -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/AvgPool2D.h b/runtimes/neurun/src/graph/operation/AvgPool2D.h deleted file mode 100644 index a856b9cd4..000000000 --- a/runtimes/neurun/src/graph/operation/AvgPool2D.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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_OPERATION_AVGPOOL2D_H__ -#define __NEURUN_GRAPH_OPERATION_AVGPOOL2D_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace AvgPool2D -{ -namespace Implicit -{ - -struct Param -{ - int32_t kw_index; - int32_t kh_index; - - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; -}; - -class Node : public graph::operation::Node -{ -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void accept(NodeVisitor &&) const override; - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace Implicit -} // namespace AvgPool2D -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_AVGPOOL2D_H__ diff --git a/runtimes/neurun/src/graph/operation/Concat.cc b/runtimes/neurun/src/graph/operation/Concat.cc deleted file mode 100644 index 952cf687c..000000000 --- a/runtimes/neurun/src/graph/operation/Concat.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 "Concat.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Concat -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count > 2); // At least one one input tensor and axis - assert(init_param.output_count == 1); - - // When there are N + 1 inputs, each input should be interpreted as follows: - // - // [0, N) -> Input tensors - // N -> Axis - // - - { - operand::IndexSet inds; - for (uint32_t n = 0; n < init_param.input_count - 1; ++n) - { - inds.append(operand::Index{init_param.inputs[n]}); - } - setInputs(inds); - } - setOutputs({init_param.outputs[0]}); - - _param.axis_index = init_param.inputs[init_param.input_count - 1]; -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Concat -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Concat.h b/runtimes/neurun/src/graph/operation/Concat.h deleted file mode 100644 index dab17d031..000000000 --- a/runtimes/neurun/src/graph/operation/Concat.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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_OPERATION_CONCAT_H__ -#define __NEURUN_GRAPH_OPERATION_CONCAT_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Concat -{ - -struct Param -{ - int32_t axis_index; -}; - -class Node : public graph::operation::Node -{ -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void accept(NodeVisitor &&) const override; - -public: - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace Concat -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_CONCAT_H__ diff --git a/runtimes/neurun/src/graph/operation/Conv2D.cc b/runtimes/neurun/src/graph/operation/Conv2D.cc deleted file mode 100644 index f88955db1..000000000 --- a/runtimes/neurun/src/graph/operation/Conv2D.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 "Conv2D.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Conv2D -{ -namespace Implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 7 && init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // - // 0 -> IFM Tensor Index - // 1 -> Kernel Tensor Index - // 2 -> Bias Tensor Index - // 3 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 4 -> Stride (width) Index - // 5 -> Stride (height) INdex - // 6 -> Activation Index - - setInputs({init_param.inputs[0], init_param.inputs[1], init_param.inputs[2]}); - setOutputs({init_param.outputs[0]}); - - _param.padding_index = init_param.inputs[3]; - _param.hstride_index = init_param.inputs[4]; - _param.vstride_index = init_param.inputs[5]; - _param.activation_index = init_param.inputs[6]; -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 3); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Implicit -} // namespace Conv2D -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Conv2D.h b/runtimes/neurun/src/graph/operation/Conv2D.h deleted file mode 100644 index f75058a30..000000000 --- a/runtimes/neurun/src/graph/operation/Conv2D.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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_OPERATION_CONV2D_H__ -#define __NEURUN_GRAPH_OPERATION_CONV2D_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Conv2D -{ -namespace Implicit -{ - -struct Param -{ - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; -}; - -class Node : public graph::operation::Node -{ -public: - Node(const graph::operation::Node::InitParam &); - -public: - virtual void accept(NodeVisitor &&) const override; - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace Implicit -} // namespace Conv2D -} // namespace coperation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_CONV2D_H__ diff --git a/runtimes/neurun/src/graph/operation/FullyConnected.cc b/runtimes/neurun/src/graph/operation/FullyConnected.cc deleted file mode 100644 index 0a6553d1e..000000000 --- a/runtimes/neurun/src/graph/operation/FullyConnected.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 "FullyConnected.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace FullyConnected -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 4 && init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // 0 -> A tensor, specifying the input. - // 1 -> A 2-D tensor, specifying the weights - // 2 -> A 1-D tensor, specifying the bias - // 3 -> An INT32 value, and has to be one of the FuseCode values - - setInputs({init_param.inputs[0], init_param.inputs[1], init_param.inputs[2]}); - setOutputs({init_param.outputs[0]}); - - _param.activation_index = init_param.inputs[3]; -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 3); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace FullyConnected -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/FullyConnected.h b/runtimes/neurun/src/graph/operation/FullyConnected.h deleted file mode 100644 index a1f920e4b..000000000 --- a/runtimes/neurun/src/graph/operation/FullyConnected.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_OPERATION_FULLYCONNECTED_H__ -#define __NEURUN_GRAPH_OPERATION_FULLYCONNECTED_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace FullyConnected -{ - -struct Param -{ - int32_t activation_index; -}; - -class Node : public graph::operation::Node -{ -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void accept(NodeVisitor &&) const override; - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace FullyConnected -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_FULLYCONNECTED_H__ diff --git a/runtimes/neurun/src/graph/operation/Index.h b/runtimes/neurun/src/graph/operation/Index.h deleted file mode 100644 index 3902d039b..000000000 --- a/runtimes/neurun/src/graph/operation/Index.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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_OPERATION_INDEX_H__ -#define __NEURUN_GRAPH_OPERATION_INDEX_H__ - -#include "graph/Index.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -using Index = ::neurun::graph::Index<uint32_t, struct IndexTag>; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_INDEX_H__ diff --git a/runtimes/neurun/src/graph/operation/IndexList.cc b/runtimes/neurun/src/graph/operation/IndexList.cc deleted file mode 100644 index cdc5997ea..000000000 --- a/runtimes/neurun/src/graph/operation/IndexList.cc +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 "IndexList.h" - -#include <algorithm> - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -IndexList::IndexList(std::initializer_list<Index> list) : _list(list) -{ - // DO NOTHING -} - -bool IndexList::contains(const ::neurun::graph::operation::Index &index) const -{ - return std::find(_list.begin(), _list.end(), index) != _list.end(); -} - -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/IndexList.h b/runtimes/neurun/src/graph/operation/IndexList.h deleted file mode 100644 index cfac46abc..000000000 --- a/runtimes/neurun/src/graph/operation/IndexList.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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_OPERATION_INDEX_LIST_H__ -#define __NEURUN_GRAPH_OPERATION_INDEX_LIST_H__ - -#include <initializer_list> -#include <list> - -#include "Index.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -class IndexList -{ -public: - IndexList(void) = default; - IndexList(std::initializer_list<Index> list); - -public: - void append(const Index &index) { _list.push_back(index); } - void remove(const Index &index) { _list.remove(index); } - -public: - uint32_t size() const { return static_cast<uint32_t>(_list.size()); } - const std::list<Index> &list() const { return _list; } - bool contains(const Index &index) const; - -private: - std::list<Index> _list; -}; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_INDEX_LIST_H__ diff --git a/runtimes/neurun/src/graph/operation/LowerInfo.cc b/runtimes/neurun/src/graph/operation/LowerInfo.cc index 2998b1922..7862fd0c9 100644 --- a/runtimes/neurun/src/graph/operation/LowerInfo.cc +++ b/runtimes/neurun/src/graph/operation/LowerInfo.cc @@ -23,7 +23,7 @@ namespace graph namespace operation { -LowerInfo::LowerInfo(const backend::Backend &backend) : _backend(backend) +LowerInfo::LowerInfo(const backend::Backend *backend) : _backend(backend) { // DO NOTHING } diff --git a/runtimes/neurun/src/graph/operation/LowerInfo.h b/runtimes/neurun/src/graph/operation/LowerInfo.h index f3fbbf178..e920b0eb9 100644 --- a/runtimes/neurun/src/graph/operation/LowerInfo.h +++ b/runtimes/neurun/src/graph/operation/LowerInfo.h @@ -31,11 +31,11 @@ namespace operation class LowerInfo { public: - LowerInfo(const backend::Backend &backend); - const backend::Backend &backend() const { return _backend; } + LowerInfo(const backend::Backend *backend); + const backend::Backend *backend() const { return _backend; } private: - backend::Backend _backend; + const backend::Backend *_backend; }; } // namespace operation diff --git a/runtimes/neurun/src/graph/operation/MaxPool2D.cc b/runtimes/neurun/src/graph/operation/MaxPool2D.cc deleted file mode 100644 index 76648baf6..000000000 --- a/runtimes/neurun/src/graph/operation/MaxPool2D.cc +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 "MaxPool2D.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace MaxPool2D -{ -namespace Implicit -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 7); - assert(init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // 0 -> IFM Tensor Index - // 1 -> Padding Code (ANEURALNETWORKS_PADDING_SAME or ANEURALNETWORKS_PADDING_VALID) Index - // 2 -> Horizontal (over width) Stride Index - // 3 -> Vertial (over height) Stride Index - // 4 -> Filter Width Index - // 5 -> Filter Height Index - // 6 -> FuseCode (activation) Index - - setInputs({init_param.inputs[0]}); - setOutputs({init_param.outputs[0]}); - - _param.padding_index = init_param.inputs[1]; - _param.hstride_index = init_param.inputs[2]; - _param.vstride_index = init_param.inputs[3]; - - _param.kw_index = init_param.inputs[4]; - _param.kh_index = init_param.inputs[5]; - _param.activation_index = init_param.inputs[6]; -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Implicit -} // namespace MaxPool2D -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/MaxPool2D.h b/runtimes/neurun/src/graph/operation/MaxPool2D.h deleted file mode 100644 index 30f9b0b50..000000000 --- a/runtimes/neurun/src/graph/operation/MaxPool2D.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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_OPERATION_MAXPOOL2D_H__ -#define __NEURUN_GRAPH_OPERATION_MAXPOOL2D_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace MaxPool2D -{ -namespace Implicit -{ - -struct Param -{ - int32_t kw_index; - int32_t kh_index; - - int32_t hstride_index; - int32_t vstride_index; - - int32_t padding_index; - int32_t activation_index; -}; - -class Node : public graph::operation::Node -{ -public: - virtual void accept(NodeVisitor &&) const override; - -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace Implicit -} // namespace MaxPool2D -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_MAXPOOL2D_H__ diff --git a/runtimes/neurun/src/graph/operation/NOP.cc b/runtimes/neurun/src/graph/operation/NOP.cc deleted file mode 100644 index 18c3246ce..000000000 --- a/runtimes/neurun/src/graph/operation/NOP.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 "NOP.h" - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace NOP -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -} // namespace NOP -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/NOP.h b/runtimes/neurun/src/graph/operation/NOP.h deleted file mode 100644 index 51b0f6f71..000000000 --- a/runtimes/neurun/src/graph/operation/NOP.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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_OPERATION_NOP_H__ -#define __NEURUN_GRAPH_OPERATION_NOP_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace NOP -{ - -class Node : public graph::operation::Node -{ -public: - Node(const graph::operation::Node::InitParam &) {} - -public: - virtual void accept(NodeVisitor &&) const override; -}; - -} // namespace NOP -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_NOP_H__ diff --git a/runtimes/neurun/src/graph/operation/Node.cc b/runtimes/neurun/src/graph/operation/Node.cc deleted file mode 100644 index f472bc08c..000000000 --- a/runtimes/neurun/src/graph/operation/Node.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 "Node.h" - -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -Node::Node() = default; - -Node::~Node() = default; - -void Node::lower_info(std::unique_ptr<LowerInfo> &&lower_info) -{ - _lower_info = std::move(lower_info); -} - -const LowerInfo *Node::lower_info() const { return _lower_info.get(); } - -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Node.h b/runtimes/neurun/src/graph/operation/Node.h deleted file mode 100644 index 9e98184e3..000000000 --- a/runtimes/neurun/src/graph/operation/Node.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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_OPERATION_NODE_H__ -#define __NEURUN_GRAPH_OPERATION_NODE_H__ - -#include <memory> - -#include "graph/operand/IndexSet.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -class LowerInfo; -struct NodeVisitor; - -class Node -{ -public: - struct InitParam - { - uint32_t input_count; - const uint32_t *inputs; - uint32_t output_count; - const uint32_t *outputs; - }; - -public: - Node(); - virtual ~Node(); - -public: - virtual void accept(NodeVisitor &&) const = 0; - -public: - virtual const operand::IndexSet &getInputs() const { return _inputs; } - virtual const operand::IndexSet &getOutputs() const { return _outputs; } - // It's for only input/output tensors but const data. - virtual void setInputs(const operand::IndexSet &indexes) { _inputs = indexes; } - virtual void setOutputs(const operand::IndexSet &indexes) { _outputs = indexes; } - -public: - void lower_info(std::unique_ptr<LowerInfo> &&lower_info); - const LowerInfo *lower_info() const; - -private: - operand::IndexSet _inputs; - operand::IndexSet _outputs; - std::unique_ptr<LowerInfo> _lower_info; -}; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_NODE_H__ diff --git a/runtimes/neurun/src/graph/operation/NodeVisitor.h b/runtimes/neurun/src/graph/operation/NodeVisitor.h deleted file mode 100644 index 28d19b0af..000000000 --- a/runtimes/neurun/src/graph/operation/NodeVisitor.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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_OPERATION_NODE_VISITOR_H__ -#define __NEURUN_GRAPH_OPERATION_NODE_VISITOR_H__ - -#include "Conv2D.h" -#include "MaxPool2D.h" -#include "AvgPool2D.h" -#include "Concat.h" -#include "Reshape.h" -#include "FullyConnected.h" -#include "Softmax.h" -#include "NOP.h" -#include "Permute.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -struct NodeVisitor -{ - virtual ~NodeVisitor() = default; - - virtual void visit(const Conv2D::Implicit::Node &) = 0; - virtual void visit(const MaxPool2D::Implicit::Node &) = 0; - virtual void visit(const AvgPool2D::Implicit::Node &) = 0; - virtual void visit(const Concat::Node &) = 0; - virtual void visit(const Reshape::Node &) = 0; - virtual void visit(const FullyConnected::Node &) = 0; - virtual void visit(const Softmax::Node &) = 0; - virtual void visit(const NOP::Node &) = 0; - virtual void visit(const Permute::Node &) = 0; -}; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_NODE_VISITOR_H__ diff --git a/runtimes/neurun/src/graph/operation/Op.lst b/runtimes/neurun/src/graph/operation/Op.lst deleted file mode 100644 index 23b4123cb..000000000 --- a/runtimes/neurun/src/graph/operation/Op.lst +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 OP -#error Define OP before including this file -#endif - -// NOTE The relation between "Internal Name" and "NN API Name" is "1 : N". - -// Internal Name | NN API Name -OP(Conv2D::Implicit , CONV_2D) -OP(AvgPool2D::Implicit , AVERAGE_POOL_2D) -OP(MaxPool2D::Implicit , MAX_POOL_2D) -OP(Concat , CONCATENATION) -OP(FullyConnected , FULLY_CONNECTED) -OP(Reshape , RESHAPE) -OP(Softmax , SOFTMAX) diff --git a/runtimes/neurun/src/graph/operation/Permute.cc b/runtimes/neurun/src/graph/operation/Permute.cc deleted file mode 100644 index 2688e5e5f..000000000 --- a/runtimes/neurun/src/graph/operation/Permute.cc +++ /dev/null @@ -1,41 +0,0 @@ -#include "Permute.h" - -#include <cassert> - -#include "NodeVisitor.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Permute -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const operand::Index &input, const operand::Index &output) -{ - setInputs({input}); - setOutputs({output}); -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Permute -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Permute.h b/runtimes/neurun/src/graph/operation/Permute.h deleted file mode 100644 index 540f869b1..000000000 --- a/runtimes/neurun/src/graph/operation/Permute.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ -#define __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Permute -{ - -class Node : public graph::operation::Node -{ -public: - virtual void accept(NodeVisitor &&) const override; - -public: - Node(const operand::Index &input, const operand::Index &output); - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; -}; - -} // namespace Permute -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_PERMUTE_PERMUTE_H__ diff --git a/runtimes/neurun/src/graph/operation/Reshape.cc b/runtimes/neurun/src/graph/operation/Reshape.cc deleted file mode 100644 index e6bc2117f..000000000 --- a/runtimes/neurun/src/graph/operation/Reshape.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 "Reshape.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Reshape -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 2 && init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // 0 -> A tensor, specifying the tensor to be reshaped. - // 1 -> A 1-D tensor of type ANEURALNETWORKS_TENSOR_INT32, defining the shape of the output - // tensor - - // TODO Second input should be shape tensor (init_param.inputs[1]) - setInputs({init_param.inputs[0] /* , init_param.inputs[1] */}); - setOutputs({init_param.outputs[0]}); -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); // TODO Should be 2 (See also the constructor) - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Reshape -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Reshape.h b/runtimes/neurun/src/graph/operation/Reshape.h deleted file mode 100644 index 168719b46..000000000 --- a/runtimes/neurun/src/graph/operation/Reshape.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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_OPERATION_RESHAPE_H__ -#define __NEURUN_GRAPH_OPERATION_RESHAPE_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Reshape -{ - -class Node : public graph::operation::Node -{ -public: - virtual void accept(NodeVisitor &&) const override; - -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; -}; - -} // namespace Reshape -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_RESHAPE_H__ diff --git a/runtimes/neurun/src/graph/operation/Set.cc b/runtimes/neurun/src/graph/operation/Set.cc deleted file mode 100644 index a1ddfa6d4..000000000 --- a/runtimes/neurun/src/graph/operation/Set.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 "Set.h" - -#include <cassert> - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -const Index Set::generateIndex() -{ - assert((_index_count) <= 0x7fffffff); - - return Index{_index_count++}; -} - -Index Set::append(std::unique_ptr<Node> &&node) -{ - auto index = generateIndex(); - - _nodes[index] = std::move(node); - return index; -} - -const Node &Set::at(const Index &index) const { return *(_nodes.at(index)); } - -Node &Set::at(const Index &index) { return *(_nodes.at(index)); } - -bool Set::exist(const Index &index) const { return _nodes.find(index) != _nodes.end(); } - -void Set::iterate(const std::function<void(const Index &, const Node &)> &fn) const -{ - for (auto it = _nodes.begin(); it != _nodes.end(); ++it) - { - fn(it->first, *it->second); - } -} - -void Set::iterate(const std::function<void(const Index &, Node &)> &fn) -{ - for (auto it = _nodes.begin(); it != _nodes.end(); ++it) - { - fn(it->first, *it->second); - } -} - -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Set.h b/runtimes/neurun/src/graph/operation/Set.h deleted file mode 100644 index bc6913ff4..000000000 --- a/runtimes/neurun/src/graph/operation/Set.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_OPERATION_SET_H__ -#define __NEURUN_GRAPH_OPERATION_SET_H__ - -#include <memory> - -#include "graph/operation/Index.h" -#include "Node.h" - -#include <unordered_map> - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -class Set -{ -public: - Set() : _index_count(0) {} - -public: - Index append(std::unique_ptr<Node> &&node); - -public: - const Node &at(const Index &) const; - Node &at(const Index &); - bool exist(const Index &) const; - uint32_t size() const { return _nodes.size(); } - void iterate(const std::function<void(const Index &, const Node &)> &fn) const; - void iterate(const std::function<void(const Index &, Node &)> &fn); - -private: - const Index generateIndex(); - -private: - std::unordered_map<Index, std::unique_ptr<Node>> _nodes; - uint32_t _index_count; -}; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_SET_H__ diff --git a/runtimes/neurun/src/graph/operation/Softmax.cc b/runtimes/neurun/src/graph/operation/Softmax.cc deleted file mode 100644 index 3b3c8661f..000000000 --- a/runtimes/neurun/src/graph/operation/Softmax.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 "Softmax.h" - -#include <cassert> - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Softmax -{ - -void Node::accept(NodeVisitor &&v) const { v.visit(*this); } - -Node::Node(const graph::operation::Node::InitParam &init_param) -{ - assert(init_param.input_count == 2 && init_param.output_count == 1); - - // Each input should be interpreted as follows: - // - // 0 -> A 2-D or 4-D tensor, specifying the tensor to be reshaped. - // 1 -> FLOAT32 value, specifying the positive scaling factor for the exponent, beta. - - setInputs({init_param.inputs[0]}); - setOutputs({init_param.outputs[0]}); - - _param.scale_index = init_param.inputs[1]; -} - -void Node::setInputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setInputs(indexes); -} - -void Node::setOutputs(const operand::IndexSet &indexes) -{ - assert(indexes.size() == 1); - - graph::operation::Node::setOutputs(indexes); -} - -} // namespace Softmax -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/Softmax.h b/runtimes/neurun/src/graph/operation/Softmax.h deleted file mode 100644 index e87a27518..000000000 --- a/runtimes/neurun/src/graph/operation/Softmax.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_OPERATION_SOFTMAX_H__ -#define __NEURUN_GRAPH_OPERATION_SOFTMAX_H__ - -#include <memory> - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ -namespace Softmax -{ - -struct Param -{ - int32_t scale_index; -}; - -class Node : public graph::operation::Node -{ -public: - virtual void accept(NodeVisitor &&) const override; - -public: - Node(const graph::operation::Node::InitParam &init_param); - -public: - virtual void setInputs(const operand::IndexSet &indexes) override; - virtual void setOutputs(const operand::IndexSet &indexes) override; - -public: - const Param ¶m() const { return _param; } - -private: - Param _param; -}; - -} // namespace Softmax -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_SOFTMAX_H__ |