diff options
author | David Monahan <david.monahan@arm.com> | 2023-03-22 16:48:58 +0000 |
---|---|---|
committer | David Monahan <david.monahan@arm.com> | 2023-03-22 16:48:58 +0000 |
commit | ae050524109f1ce827962665436ef7430f2ac479 (patch) | |
tree | a087fe0c77570971dd7979f2757426c24e91afc7 /23.02/_elementwise_unary_operator_8cpp_source.xhtml | |
parent | 8d2ca734165a068478df7cffa46185680b05cd20 (diff) | |
download | armnn-ae050524109f1ce827962665436ef7430f2ac479.tar.gz |
IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub.
* Updating Doxygen documentation for 23.02 release.
Signed-off-by: David Monahan <david.monahan@arm.com>
Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82
Diffstat (limited to '23.02/_elementwise_unary_operator_8cpp_source.xhtml')
-rw-r--r-- | 23.02/_elementwise_unary_operator_8cpp_source.xhtml | 125 |
1 files changed, 100 insertions, 25 deletions
diff --git a/23.02/_elementwise_unary_operator_8cpp_source.xhtml b/23.02/_elementwise_unary_operator_8cpp_source.xhtml index 6b1cf950e5..9a08cf15d9 100644 --- a/23.02/_elementwise_unary_operator_8cpp_source.xhtml +++ b/23.02/_elementwise_unary_operator_8cpp_source.xhtml @@ -8,7 +8,7 @@ <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> -<meta name="generator" content="Doxygen 1.8.13"/> +<meta name="generator" content="Doxygen 1.8.17"/> <meta name="robots" content="NOINDEX, NOFOLLOW" /> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>ArmNN: src/backends/tosaCommon/operatorMappings/ElementwiseUnaryOperator.cpp Source File</title> @@ -19,9 +19,6 @@ <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> -<script type="text/javascript"> - $(document).ready(initResizable); -</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> @@ -30,7 +27,8 @@ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); -</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> +</script> +<script type="text/javascript" async="async" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="stylesheet.css" rel="stylesheet" type="text/css"/> </head> @@ -51,18 +49,21 @@ </table> </div> <!-- end header part --> -<!-- Generated by Doxygen 1.8.13 --> +<!-- Generated by Doxygen 1.8.17 --> <script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); +/* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); -</script> +/* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> @@ -76,7 +77,9 @@ $(function() { </div> </div> <script type="text/javascript"> -$(document).ready(function(){initNavTree('_elementwise_unary_operator_8cpp_source.xhtml','');}); +/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ +$(document).ready(function(){initNavTree('_elementwise_unary_operator_8cpp_source.xhtml',''); initResizable(); }); +/* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> @@ -98,30 +101,102 @@ $(document).ready(function(){initNavTree('_elementwise_unary_operator_8cpp_sourc <div class="title">ElementwiseUnaryOperator.cpp</div> </div> </div><!--header--> <div class="contents"> -<a href="_elementwise_unary_operator_8cpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> </div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="_elementwise_unary_operator_8hpp.xhtml">ElementwiseUnaryOperator.hpp</a>"</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> </div><div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="_elementwise_unary_operator_8hpp.xhtml#a40f1db172f158b173106f411be4d5e47"> 8</a></span> TosaSerializationBasicBlock* <a class="code" href="_elementwise_unary_operator_8cpp.xhtml#a40f1db172f158b173106f411be4d5e47">ConvertElementwiseUnaryOperator</a>(<span class="keyword">const</span> <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>* layer,</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  <span class="keyword">const</span> std::vector<const TensorInfo*>& inputs,</div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  <span class="keyword">const</span> std::vector<const TensorInfo*>& outputs,</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  <span class="keyword">const</span> <a class="code" href="structarmnn_1_1_elementwise_unary_descriptor.xhtml">ElementwiseUnaryDescriptor</a>* unaryDescriptor)</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> {</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>  std::string input0Name = std::string(<span class="stringliteral">"input0_"</span>);</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  std::string outputName = std::string(<span class="stringliteral">"output0_"</span>);</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  std::string blockName = std::string(<span class="stringliteral">"Op_ELEMENTWISEUNARY_block_"</span>) + <a class="code" href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a>();</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> </div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  <span class="comment">// If a layer is present then the block will be used for execution, so input and output names need to be determined</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="comment">// using the previous and following layers so the graph is connected correctly. For validation this doesn't matter.</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">if</span>(layer != <span class="keyword">nullptr</span>)</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  {</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="comment">// Get the layer connected to the input slot and determine unique the tensor name.</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>& connectedLayer0 = layer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>()-><a class="code" href="classarmnn_1_1_output_slot.xhtml#a7ddaf04177053a536f0e7be83a642bc6">GetOwningLayer</a>();</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  input0Name = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a1640c964a461e8580837a79829a5c197">GenerateUniqueName</a>(connectedLayer0, 0);</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="comment">// Determine unique output tensor name.</span></div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  outputName = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a246662c69dac647833be50ba6dcee024">GenerateUniqueOutputName</a>(*layer, 0);</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  }</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  TosaSerializationOperator* op = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">switch</span>(unaryDescriptor-><a class="code" href="structarmnn_1_1_elementwise_unary_descriptor.xhtml#afe768be66897eb3d73284424e3239b23">m_Operation</a>)</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  {</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">case</span> UnaryOperation::Rsqrt:</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  op = <span class="keyword">new</span> TosaSerializationOperator(tosa::Op_RSQRT,</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  Attribute_NONE,</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keyword">nullptr</span>,</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  {input0Name},</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  {outputName});</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  blockName = std::string(<span class="stringliteral">"Op_RSQRT_block_"</span>) + <a class="code" href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a>();</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  }</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_exception.xhtml">armnn::Exception</a>(<span class="stringliteral">"ConvertElementwiseUnaryToTosaOperator: Unsupported layer type."</span>);</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span> </div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="code" href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a>(op != <span class="keyword">nullptr</span>);</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span> </div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  std::vector<TosaSerializationTensor*> tensors;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">// Only add input tensor if connected layer is an input layer.</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">// As intermediate or constant tensors will be created separately.</span></div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// There also can't be duplicate tensor.</span></div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">if</span>(input0Name.find(<span class="stringliteral">"input0_"</span>) != std::string::npos)</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  std::vector<int32_t> inputShape0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a>(inputs[0]->GetShape());</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  DType inputDType0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a>(inputs[0]->GetDataType());</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  tensors.push_back(<span class="keyword">new</span> TosaSerializationTensor(input0Name, inputShape0, inputDType0, {}));</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  }</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span> </div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  std::vector<int32_t> outputShape0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a>(outputs[0]->GetShape());</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  DType outputDType0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a>(outputs[0]->GetDataType());</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  tensors.push_back(<span class="keyword">new</span> TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// operatorInputNames/operatorOutputNames ends up being the same as</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// blockInputNames/blockOutputNames for one-to-one ArmNN to Tosa mappings</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">return</span> <span class="keyword">new</span> TosaSerializationBasicBlock(blockName, <span class="comment">// name</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  {op}, <span class="comment">// operators</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  tensors, <span class="comment">// tensors</span></div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  {input0Name}, <span class="comment">// inputs</span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {outputName}); <span class="comment">// outputs</span></div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span> }</div><div class="ttc" id="_tosa_operator_utils_8hpp_xhtml_a7d97964a65be4eb4a5b4109904f2e7f7"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a></div><div class="ttdeci">std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00049">TosaOperatorUtils.hpp:49</a></div></div> -<div class="ttc" id="structarmnn_1_1_elementwise_unary_descriptor_xhtml_afe768be66897eb3d73284424e3239b23"><div class="ttname"><a href="structarmnn_1_1_elementwise_unary_descriptor.xhtml#afe768be66897eb3d73284424e3239b23">armnn::ElementwiseUnaryDescriptor::m_Operation</a></div><div class="ttdeci">UnaryOperation m_Operation</div><div class="ttdoc">Specifies the elementwiseUnary operation to execute. </div><div class="ttdef"><b>Definition:</b> <a href="_descriptors_8hpp_source.xhtml#l00125">Descriptors.hpp:125</a></div></div> -<div class="ttc" id="classarmnn_1_1_output_slot_xhtml_a7ddaf04177053a536f0e7be83a642bc6"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml#a7ddaf04177053a536f0e7be83a642bc6">armnn::OutputSlot::GetOwningLayer</a></div><div class="ttdeci">Layer & GetOwningLayer() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00119">Layer.hpp:119</a></div></div> -<div class="ttc" id="_elementwise_unary_operator_8cpp_xhtml_a40f1db172f158b173106f411be4d5e47"><div class="ttname"><a href="_elementwise_unary_operator_8cpp.xhtml#a40f1db172f158b173106f411be4d5e47">ConvertElementwiseUnaryOperator</a></div><div class="ttdeci">TosaSerializationBasicBlock * ConvertElementwiseUnaryOperator(const Layer *layer, const std::vector< const TensorInfo *> &inputs, const std::vector< const TensorInfo *> &outputs, const ElementwiseUnaryDescriptor *unaryDescriptor)</div><div class="ttdef"><b>Definition:</b> <a href="_elementwise_unary_operator_8cpp_source.xhtml#l00008">ElementwiseUnaryOperator.cpp:8</a></div></div> -<div class="ttc" id="_tosa_operator_utils_8hpp_xhtml_a45d66f17ad6b0469e469f443b3e03226"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a></div><div class="ttdeci">DType ArmNNToDType(const DataType &type)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00020">TosaOperatorUtils.hpp:20</a></div></div> -<div class="ttc" id="_tosa_operator_utils_8hpp_xhtml_aadc5d73bd0cb81999bcfdc62bce020e8"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a></div><div class="ttdeci">std::string GetUniqueTosaMappingID()</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00097">TosaOperatorUtils.hpp:97</a></div></div> -<div class="ttc" id="_tosa_operator_utils_8hpp_xhtml_a1640c964a461e8580837a79829a5c197"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a1640c964a461e8580837a79829a5c197">GenerateUniqueName</a></div><div class="ttdeci">std::string GenerateUniqueName(const Layer &layer, uint32_t layerSlot)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00060">TosaOperatorUtils.hpp:60</a></div></div> -<div class="ttc" id="classarmnn_1_1_layer_xhtml_acf8b8e23bf647836592982f97088d375"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">armnn::Layer::GetInputSlot</a></div><div class="ttdeci">const InputSlot & GetInputSlot(unsigned int index) const override</div><div class="ttdoc">Get a const input slot handle by slot index. </div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00324">Layer.hpp:324</a></div></div> -<div class="ttc" id="_elementwise_unary_operator_8hpp_xhtml"><div class="ttname"><a href="_elementwise_unary_operator_8hpp.xhtml">ElementwiseUnaryOperator.hpp</a></div></div> -<div class="ttc" id="_tosa_operator_utils_8hpp_xhtml_a246662c69dac647833be50ba6dcee024"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a246662c69dac647833be50ba6dcee024">GenerateUniqueOutputName</a></div><div class="ttdeci">std::string GenerateUniqueOutputName(const Layer &layer, uint32_t layerSlot)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00079">TosaOperatorUtils.hpp:79</a></div></div> -<div class="ttc" id="_assert_8hpp_xhtml_a5698be69cbd5dfe6c28fcd9867e8cbed"><div class="ttname"><a href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a></div><div class="ttdeci">#define ARMNN_ASSERT(COND)</div><div class="ttdef"><b>Definition:</b> <a href="_assert_8hpp_source.xhtml#l00014">Assert.hpp:14</a></div></div> -<div class="ttc" id="classarmnn_1_1_input_slot_xhtml_a9effd325a6d512a3f8ff4bd207d53255"><div class="ttname"><a href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">armnn::InputSlot::GetConnectedOutputSlot</a></div><div class="ttdeci">const OutputSlot * GetConnectedOutputSlot() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00056">Layer.hpp:56</a></div></div> -<div class="ttc" id="structarmnn_1_1_elementwise_unary_descriptor_xhtml"><div class="ttname"><a href="structarmnn_1_1_elementwise_unary_descriptor.xhtml">armnn::ElementwiseUnaryDescriptor</a></div><div class="ttdoc">A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer. </div><div class="ttdef"><b>Definition:</b> <a href="_descriptors_8hpp_source.xhtml#l00109">Descriptors.hpp:109</a></div></div> -<div class="ttc" id="classarmnn_1_1_exception_xhtml"><div class="ttname"><a href="classarmnn_1_1_exception.xhtml">armnn::Exception</a></div><div class="ttdoc">Base class for all ArmNN exceptions so that users can filter to just those. </div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.xhtml#l00046">Exceptions.hpp:46</a></div></div> -<div class="ttc" id="classarmnn_1_1_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml">armnn::Layer</a></div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00217">Layer.hpp:217</a></div></div> +<a href="_elementwise_unary_operator_8cpp.xhtml">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div> +<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.</span></div> +<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div> +<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div> +<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>  </div> +<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "<a class="code" href="_elementwise_unary_operator_8hpp.xhtml">ElementwiseUnaryOperator.hpp</a>"</span></div> +<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  </div> +<div class="line"><a name="l00008"></a><span class="lineno"><a class="line" href="_elementwise_unary_operator_8hpp.xhtml#a99f70cdf08ee4d679bace71967e36de9"> 8</a></span> TosaSerializationBasicBlock* <a class="code" href="_elementwise_unary_operator_8cpp.xhtml#a99f70cdf08ee4d679bace71967e36de9">ConvertElementwiseUnaryOperator</a>(<span class="keyword">const</span> <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>* layer,</div> +<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>  <span class="keyword">const</span> std::vector<const TensorInfo*>& inputs,</div> +<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>  <span class="keyword">const</span> std::vector<const TensorInfo*>& outputs,</div> +<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>  <span class="keyword">const</span> <a class="code" href="structarmnn_1_1_elementwise_unary_descriptor.xhtml">ElementwiseUnaryDescriptor</a>* unaryDescriptor)</div> +<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> {</div> +<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>  std::string input0Name = std::string(<span class="stringliteral">"input0_"</span>);</div> +<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>  std::string outputName = std::string(<span class="stringliteral">"output0_"</span>);</div> +<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>  std::string blockName = std::string(<span class="stringliteral">"Op_ELEMENTWISEUNARY_block_"</span>) + <a class="code" href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a>();</div> +<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>  </div> +<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>  </div> +<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>  <span class="comment">// If a layer is present then the block will be used for execution, so input and output names need to be determined</span></div> +<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>  <span class="comment">// using the previous and following layers so the graph is connected correctly. For validation this doesn't matter.</span></div> +<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>  <span class="keywordflow">if</span>(layer != <span class="keyword">nullptr</span>)</div> +<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>  {</div> +<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>  <span class="comment">// Get the layer connected to the input slot and determine unique the tensor name.</span></div> +<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  <a class="code" href="classarmnn_1_1_layer.xhtml">Layer</a>& connectedLayer0 = layer-><a class="code" href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">GetInputSlot</a>(0).<a class="code" href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">GetConnectedOutputSlot</a>()-><a class="code" href="classarmnn_1_1_output_slot.xhtml#a7ddaf04177053a536f0e7be83a642bc6">GetOwningLayer</a>();</div> +<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  input0Name = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a1640c964a461e8580837a79829a5c197">GenerateUniqueName</a>(connectedLayer0, 0);</div> +<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  </div> +<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="comment">// Determine unique output tensor name.</span></div> +<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  outputName = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a246662c69dac647833be50ba6dcee024">GenerateUniqueOutputName</a>(*layer, 0);</div> +<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  }</div> +<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  </div> +<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  TosaSerializationOperator* op = <span class="keyword">nullptr</span>;</div> +<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">switch</span>(unaryDescriptor-><a class="code" href="structarmnn_1_1_elementwise_unary_descriptor.xhtml#afe768be66897eb3d73284424e3239b23">m_Operation</a>)</div> +<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  {</div> +<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">case</span> UnaryOperation::Rsqrt:</div> +<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  {</div> +<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  op = <span class="keyword">new</span> TosaSerializationOperator(tosa::Op_RSQRT,</div> +<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  Attribute_NONE,</div> +<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="keyword">nullptr</span>,</div> +<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  {input0Name},</div> +<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  {outputName});</div> +<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  blockName = std::string(<span class="stringliteral">"Op_RSQRT_block_"</span>) + <a class="code" href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a>();</div> +<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="keywordflow">break</span>;</div> +<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  }</div> +<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">default</span>:</div> +<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  <span class="keywordflow">throw</span> <a class="code" href="classarmnn_1_1_exception.xhtml">armnn::Exception</a>(<span class="stringliteral">"ConvertElementwiseUnaryToTosaOperator: Unsupported layer type."</span>);</div> +<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  }</div> +<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  </div> +<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <a class="code" href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a>(op != <span class="keyword">nullptr</span>);</div> +<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  </div> +<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  std::vector<TosaSerializationTensor*> tensors;</div> +<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">// Only add input tensor if connected layer is an input layer.</span></div> +<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="comment">// As intermediate or constant tensors will be created separately.</span></div> +<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="comment">// There also can't be duplicate tensor.</span></div> +<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="keywordflow">if</span>(input0Name.find(<span class="stringliteral">"input0_"</span>) != std::string::npos)</div> +<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  {</div> +<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  std::vector<int32_t> inputShape0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a>(inputs[0]->GetShape());</div> +<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  DType inputDType0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a>(inputs[0]->GetDataType());</div> +<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  tensors.push_back(<span class="keyword">new</span> TosaSerializationTensor(input0Name, inputShape0, inputDType0, {}));</div> +<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  }</div> +<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  </div> +<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  std::vector<int32_t> outputShape0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a>(outputs[0]->GetShape());</div> +<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  DType outputDType0 = <a class="code" href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a>(outputs[0]->GetDataType());</div> +<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  </div> +<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  tensors.push_back(<span class="keyword">new</span> TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));</div> +<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  </div> +<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// operatorInputNames/operatorOutputNames ends up being the same as</span></div> +<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// blockInputNames/blockOutputNames for one-to-one ArmNN to Tosa mappings</span></div> +<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="keywordflow">return</span> <span class="keyword">new</span> TosaSerializationBasicBlock(blockName, <span class="comment">// name</span></div> +<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  {op}, <span class="comment">// operators</span></div> +<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  tensors, <span class="comment">// tensors</span></div> +<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  {input0Name}, <span class="comment">// inputs</span></div> +<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  {outputName}); <span class="comment">// outputs</span></div> +<div class="line"><a name="l00072"></a><span class="lineno"> 72</span> }</div> </div><!-- fragment --></div><!-- contents --> </div><!-- doc-content --> +<div class="ttc" id="a_tosa_operator_utils_8hpp_xhtml_a246662c69dac647833be50ba6dcee024"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a246662c69dac647833be50ba6dcee024">GenerateUniqueOutputName</a></div><div class="ttdeci">std::string GenerateUniqueOutputName(const Layer &layer, uint32_t layerSlot)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00079">TosaOperatorUtils.hpp:79</a></div></div> +<div class="ttc" id="astructarmnn_1_1_elementwise_unary_descriptor_xhtml"><div class="ttname"><a href="structarmnn_1_1_elementwise_unary_descriptor.xhtml">armnn::ElementwiseUnaryDescriptor</a></div><div class="ttdoc">A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.</div><div class="ttdef"><b>Definition:</b> <a href="_descriptors_8hpp_source.xhtml#l00109">Descriptors.hpp:109</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_exception_xhtml"><div class="ttname"><a href="classarmnn_1_1_exception.xhtml">armnn::Exception</a></div><div class="ttdoc">Base class for all ArmNN exceptions so that users can filter to just those.</div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.xhtml#l00046">Exceptions.hpp:46</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_input_slot_xhtml_a9effd325a6d512a3f8ff4bd207d53255"><div class="ttname"><a href="classarmnn_1_1_input_slot.xhtml#a9effd325a6d512a3f8ff4bd207d53255">armnn::InputSlot::GetConnectedOutputSlot</a></div><div class="ttdeci">const OutputSlot * GetConnectedOutputSlot() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00056">Layer.hpp:56</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_layer_xhtml"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml">armnn::Layer</a></div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00217">Layer.hpp:217</a></div></div> +<div class="ttc" id="a_tosa_operator_utils_8hpp_xhtml_a7d97964a65be4eb4a5b4109904f2e7f7"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a7d97964a65be4eb4a5b4109904f2e7f7">GetTosaTensorShape</a></div><div class="ttdeci">std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00049">TosaOperatorUtils.hpp:49</a></div></div> +<div class="ttc" id="a_elementwise_unary_operator_8cpp_xhtml_a99f70cdf08ee4d679bace71967e36de9"><div class="ttname"><a href="_elementwise_unary_operator_8cpp.xhtml#a99f70cdf08ee4d679bace71967e36de9">ConvertElementwiseUnaryOperator</a></div><div class="ttdeci">TosaSerializationBasicBlock * ConvertElementwiseUnaryOperator(const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const ElementwiseUnaryDescriptor *unaryDescriptor)</div><div class="ttdef"><b>Definition:</b> <a href="_elementwise_unary_operator_8cpp_source.xhtml#l00008">ElementwiseUnaryOperator.cpp:8</a></div></div> +<div class="ttc" id="astructarmnn_1_1_elementwise_unary_descriptor_xhtml_afe768be66897eb3d73284424e3239b23"><div class="ttname"><a href="structarmnn_1_1_elementwise_unary_descriptor.xhtml#afe768be66897eb3d73284424e3239b23">armnn::ElementwiseUnaryDescriptor::m_Operation</a></div><div class="ttdeci">UnaryOperation m_Operation</div><div class="ttdoc">Specifies the elementwiseUnary operation to execute.</div><div class="ttdef"><b>Definition:</b> <a href="_descriptors_8hpp_source.xhtml#l00125">Descriptors.hpp:125</a></div></div> +<div class="ttc" id="a_elementwise_unary_operator_8hpp_xhtml"><div class="ttname"><a href="_elementwise_unary_operator_8hpp.xhtml">ElementwiseUnaryOperator.hpp</a></div></div> +<div class="ttc" id="a_tosa_operator_utils_8hpp_xhtml_a1640c964a461e8580837a79829a5c197"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a1640c964a461e8580837a79829a5c197">GenerateUniqueName</a></div><div class="ttdeci">std::string GenerateUniqueName(const Layer &layer, uint32_t layerSlot)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00060">TosaOperatorUtils.hpp:60</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_output_slot_xhtml_a7ddaf04177053a536f0e7be83a642bc6"><div class="ttname"><a href="classarmnn_1_1_output_slot.xhtml#a7ddaf04177053a536f0e7be83a642bc6">armnn::OutputSlot::GetOwningLayer</a></div><div class="ttdeci">Layer & GetOwningLayer() const</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00119">Layer.hpp:119</a></div></div> +<div class="ttc" id="a_tosa_operator_utils_8hpp_xhtml_a45d66f17ad6b0469e469f443b3e03226"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#a45d66f17ad6b0469e469f443b3e03226">ArmNNToDType</a></div><div class="ttdeci">DType ArmNNToDType(const DataType &type)</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00020">TosaOperatorUtils.hpp:20</a></div></div> +<div class="ttc" id="aclassarmnn_1_1_layer_xhtml_acf8b8e23bf647836592982f97088d375"><div class="ttname"><a href="classarmnn_1_1_layer.xhtml#acf8b8e23bf647836592982f97088d375">armnn::Layer::GetInputSlot</a></div><div class="ttdeci">const InputSlot & GetInputSlot(unsigned int index) const override</div><div class="ttdoc">Get a const input slot handle by slot index.</div><div class="ttdef"><b>Definition:</b> <a href="_layer_8hpp_source.xhtml#l00324">Layer.hpp:324</a></div></div> +<div class="ttc" id="a_assert_8hpp_xhtml_a5698be69cbd5dfe6c28fcd9867e8cbed"><div class="ttname"><a href="_assert_8hpp.xhtml#a5698be69cbd5dfe6c28fcd9867e8cbed">ARMNN_ASSERT</a></div><div class="ttdeci">#define ARMNN_ASSERT(COND)</div><div class="ttdef"><b>Definition:</b> <a href="_assert_8hpp_source.xhtml#l00014">Assert.hpp:14</a></div></div> +<div class="ttc" id="a_tosa_operator_utils_8hpp_xhtml_aadc5d73bd0cb81999bcfdc62bce020e8"><div class="ttname"><a href="_tosa_operator_utils_8hpp.xhtml#aadc5d73bd0cb81999bcfdc62bce020e8">GetUniqueTosaMappingID</a></div><div class="ttdeci">std::string GetUniqueTosaMappingID()</div><div class="ttdef"><b>Definition:</b> <a href="_tosa_operator_utils_8hpp_source.xhtml#l00097">TosaOperatorUtils.hpp:97</a></div></div> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.xhtml">src</a></li><li class="navelem"><a class="el" href="dir_0f3cdec46afbc61a1ded8e1687c9c9a0.xhtml">backends</a></li><li class="navelem"><a class="el" href="dir_3eeadfb79f8e6e284b92aba47a7684a1.xhtml">tosaCommon</a></li><li class="navelem"><a class="el" href="dir_44a5c203710327e1068d2575c20cb7c6.xhtml">operatorMappings</a></li><li class="navelem"><a class="el" href="_elementwise_unary_operator_8cpp.xhtml">ElementwiseUnaryOperator.cpp</a></li> - <li class="footer">Generated on Fri Feb 24 2023 10:24:27 for ArmNN by + <li class="footer">Generated on Wed Mar 22 2023 15:53:02 for ArmNN by <a href="http://www.doxygen.org/index.html"> - <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> + <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li> </ul> </div> </body> |