This commit does not have any kernel implementation.
It's only for a basic structure for Logistic operation.
Signed-off-by: Jiyoung Yun <jy910.yun@samsung.com>
});
}
+void StageGenerator::visit(const model::operation::LogisticNode &)
+{
+ throw std::runtime_error("LogisticNode for acl_cl is not implemented yet");
+}
+
} // namespace acl_cl
} // namespace backend
} // namespace neurun
void StageGenerator::visit(const model::operation::TanhNode &) { throw std::runtime_error("NYI"); }
+void StageGenerator::visit(const model::operation::LogisticNode &)
+{
+ throw std::runtime_error("LogisticNode for cpu is not implemented yet");
+}
+
void StageGenerator::visit(const model::operation::PermuteNode &node)
{
const auto output_index{node.getOutputs().at(0)};
// DO NOTHING
}
+void OperationValidator::visit(const model::operation::LogisticNode &)
+{
+ // DO NOTHING
+}
+
void OperationValidator::visit(const model::operation::PermuteNode &node)
{
VERBOSE(Permute) << "Configure Permute operation" << std::endl;
return new operation::TanhNode{inputs, outputs};
};
+
+ _map[ANEURALNETWORKS_LOGISTIC] = [](const OperationFactory::Param &init_param) {
+ assert(init_param.input_count == 1 && init_param.output_count == 1);
+
+ operand::IndexSet outputs{init_param.outputs[0]};
+
+ // Each input should be interpreted as follows:
+ //
+ // 0 -> Input Tensor Index
+ operand::IndexSet inputs{init_param.inputs[0]};
+
+ return new operation::LogisticNode{inputs, outputs};
+ };
}
neurun::model::operation::Node *OperationFactory::create(ANeuralNetworksOperationType type,
case ANEURALNETWORKS_MUL:
case ANEURALNETWORKS_TANH:
case ANEURALNETWORKS_STRIDED_SLICE:
+ case ANEURALNETWORKS_LOGISTIC:
{
auto node = factory.create(type, param);
_model->addOperation(std::unique_ptr<neurun::model::operation::Node>{node});
--- /dev/null
+/*
+ * 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 "LogisticNode.h"
+
+#include <cassert>
+
+#include "NodeVisitor.h"
+
+namespace neurun
+{
+namespace model
+{
+namespace operation
+{
+
+void LogisticNode::accept(NodeVisitor &&v) const { v.visit(*this); }
+
+LogisticNode::LogisticNode(const operand::IndexSet &inputs, const operand::IndexSet &outputs)
+ : model::operation::Node{OperandConstraint::createExact(1u), inputs, outputs}
+{
+}
+
+} // namespace operation
+} // namespace model
+} // namespace neurun
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef __NEURUN_MODEL_OPERATION_LOGISTIC_NODE_H__
+#define __NEURUN_MODEL_OPERATION_LOGISTIC_NODE_H__
+
+#include "model/operation/Node.h"
+
+namespace neurun
+{
+namespace model
+{
+namespace operation
+{
+
+class LogisticNode : public model::operation::Node
+{
+public:
+ enum Input
+ {
+ INPUT = 0
+ };
+
+public:
+ LogisticNode(const operand::IndexSet &inputs, const operand::IndexSet &outputs);
+
+public:
+ virtual void accept(NodeVisitor &&) const override;
+ virtual std::string getName() const override { return "Tanh"; }
+};
+
+} // namespace operation
+} // namespace model
+} // namespace neurun
+
+#endif // __NEURUN_MODEL_OPERATION_LOGISTIC_NODE_H__
#include "StridedSliceNode.h"
#include "MulNode.h"
#include "TanhNode.h"
+#include "LogisticNode.h"
OP(SoftmaxNode , true , SOFTMAX)
OP(StridedSliceNode , true , STRIDED_SLICE)
OP(TanhNode , true , TANH)
+OP(LogisticNode , true , LOGISTIC)
OP(PermuteNode , false , NOT_AVAILABLE)