summaryrefslogtreecommitdiff
path: root/runtimes/neurun/src/model/operation/Node.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtimes/neurun/src/model/operation/Node.h')
-rw-r--r--runtimes/neurun/src/model/operation/Node.h84
1 files changed, 84 insertions, 0 deletions
diff --git a/runtimes/neurun/src/model/operation/Node.h b/runtimes/neurun/src/model/operation/Node.h
new file mode 100644
index 000000000..76f0d2d00
--- /dev/null
+++ b/runtimes/neurun/src/model/operation/Node.h
@@ -0,0 +1,84 @@
+/*
+ * 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_MODEL_OPERATION_NODE_H__
+#define __NEURUN_MODEL_OPERATION_NODE_H__
+
+#include <memory>
+
+#include "model/operand/Object.h"
+#include "model/operand/IndexSet.h"
+#include "OperandConstraint.h"
+
+namespace neurun
+{
+namespace graph
+{
+namespace operation
+{
+class LowerInfo;
+} // namespace operation
+} // namespace graph
+} // namespace neurun
+
+namespace neurun
+{
+namespace model
+{
+namespace operation
+{
+
+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(OperandConstraint input_constr);
+ virtual ~Node();
+
+public:
+ virtual void accept(NodeVisitor &&) const = 0;
+ virtual std::string getName() const = 0;
+
+public:
+ void replaceInput(const operand::Index &from, const operand::Index &to);
+ void replaceOutput(const operand::Index &from, const operand::Index &to);
+ const operand::IndexSet &getInputs() const { return _inputs; }
+ const operand::IndexSet &getOutputs() const { return _outputs; }
+ // It's for only input/output tensors but const data.
+ void setInputs(const operand::IndexSet &indexes);
+ void setOutputs(const operand::IndexSet &indexes);
+
+private:
+ operand::IndexSet _inputs;
+ operand::IndexSet _outputs;
+ OperandConstraint _input_constr;
+};
+
+} // namespace operation
+} // namespace model
+} // namespace neurun
+
+#endif // __NEURUN_MODEL_OPERATION_NODE_H__