From: 남궁석/On-Device Lab(SR)/Engineer/삼성전자 Date: Mon, 12 Aug 2019 11:00:06 +0000 (+0900) Subject: [loco] Introduce Softmax node in loco (#6492) X-Git-Tag: accepted/tizen/unified/20190903.052428~461 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=edb53d5adcc815028df25eb49d397bd497cfd0c5;p=platform%2Fcore%2Fml%2Fnnfw.git [loco] Introduce Softmax node in loco (#6492) This commit will introduce `Softmax` node in `loco` Signed-off-by: Seok NamKoong --- diff --git a/compiler/loco/include/loco/IR/CanonicalNodes.lst b/compiler/loco/include/loco/IR/CanonicalNodes.lst index 771dc35..49808d3 100644 --- a/compiler/loco/include/loco/IR/CanonicalNodes.lst +++ b/compiler/loco/include/loco/IR/CanonicalNodes.lst @@ -32,3 +32,4 @@ CANONICAL_NODE(ReLU, ReLU) CANONICAL_NODE(ReLU6, ReLU6) CANONICAL_NODE(TensorConcat, TensorConcat) CANONICAL_NODE(TensorBiasAdd, BiasAdd) +CANONICAL_NODE(TensorSoftmax, Softmax) diff --git a/compiler/loco/include/loco/IR/Nodes.h b/compiler/loco/include/loco/IR/Nodes.h index a858ad0..535136d 100644 --- a/compiler/loco/include/loco/IR/Nodes.h +++ b/compiler/loco/include/loco/IR/Nodes.h @@ -544,6 +544,34 @@ private: }; /** + * @brief Computes softmax activations + */ +template class Softmax; + +/** +* @brief Computes softmax activations for Tensor domain +*/ +template <> +class Softmax final + : public CanonicalNodeDef::Mixin> +{ +public: + Softmax() = default; + +public: + Node *input(void) const { return at(0)->node(); } + void input(Node *node) { return at(0)->node(node); } + + uint32_t axis(void) const { return _axis; } + void axis(uint32_t axis) { _axis = axis; } + +private: + uint32_t _axis = 0; +}; + +using TensorSoftmax = Softmax; + +/** * @brief Create a "Bias" from a "Tensor" * * BiasEncode currently requires a rank-1 tensor as its input.