| <!-- HTML header for doxygen 1.8.15--> |
| <!-- Remember to use version doxygen 1.8.15 +--> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <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.15"/> |
| <meta name="robots" content="NOINDEX, NOFOLLOW" /> <!-- Prevent indexing by search engines --> |
| <title>Compute Library: InPlaceOperationMutator Class Reference</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="jquery.js"></script> |
| <script type="text/javascript" src="dynsections.js"></script> |
| <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| <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"> |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| $(document).ready(initResizable); |
| /* @license-end */</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> |
| <script type="text/x-mathjax-config"> |
| MathJax.Hub.Config({ |
| extensions: ["tex2jax.js"], |
| jax: ["input/TeX","output/HTML-CSS"], |
| }); |
| </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> |
| <body> |
| <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| <div id="titlearea"> |
| <table cellspacing="0" cellpadding="0"> |
| <tbody> |
| <tr style="height: 56px;"> |
| <img alt="Compute Library" src="https://raw.githubusercontent.com/ARM-software/ComputeLibrary/gh-pages/ACL_logo.png" style="max-width: 100%;margin-top: 15px;margin-left: 10px"/> |
| <td style="padding-left: 0.5em;"> |
| <div id="projectname"> |
|  <span id="projectnumber">19.08</span> |
| </div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <!-- end header part --> |
| <!-- Generated by Doxygen 1.8.15 --> |
| <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(); }); |
| }); |
| /* @license-end */</script> |
| <div id="main-nav"></div> |
| </div><!-- top --> |
| <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| <div id="nav-tree"> |
| <div id="nav-tree-contents"> |
| <div id="nav-sync" class="sync"></div> |
| </div> |
| </div> |
| <div id="splitbar" style="-moz-user-select:none;" |
| class="ui-resizable-handle"> |
| </div> |
| </div> |
| <script type="text/javascript"> |
| /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| $(document).ready(function(){initNavTree('classarm__compute_1_1graph_1_1_in_place_operation_mutator.xhtml','');}); |
| /* @license-end */ |
| </script> |
| <div id="doc-content"> |
| <!-- window showing the filter options --> |
| <div id="MSearchSelectWindow" |
| onmouseover="return searchBox.OnSearchSelectShow()" |
| onmouseout="return searchBox.OnSearchSelectHide()" |
| onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| </div> |
| |
| <!-- iframe showing the search results (closed by default) --> |
| <div id="MSearchResultsWindow"> |
| <iframe src="javascript:void(0)" frameborder="0" |
| name="MSearchResults" id="MSearchResults"> |
| </iframe> |
| </div> |
| |
| <div class="header"> |
| <div class="summary"> |
| <a href="#pub-methods">Public Member Functions</a> </div> |
| <div class="headertitle"> |
| <div class="title">InPlaceOperationMutator Class Reference<span class="mlabels"><span class="mlabel">final</span></span></div> </div> |
| </div><!--header--> |
| <div class="contents"> |
| |
| <p>Mutation pass to optimize operations that can be performed in-place. |
| <a href="classarm__compute_1_1graph_1_1_in_place_operation_mutator.xhtml#details">More...</a></p> |
| |
| <p><code>#include <<a class="el" href="_in_place_operation_mutator_8h_source.xhtml">InPlaceOperationMutator.h</a>></code></p> |
| <div class="dynheader"> |
| Collaboration diagram for InPlaceOperationMutator:</div> |
| <div class="dyncontent"> |
| <div class="center"><iframe scrolling="no" frameborder="0" src="classarm__compute_1_1graph_1_1_in_place_operation_mutator__coll__graph.svg" width="191" height="112"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe> |
| </div> |
| <center><span class="legend">[<a target="top" href="graph_legend.xhtml">legend</a>]</span></center></div> |
| <table class="memberdecls"> |
| <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> |
| Public Member Functions</h2></td></tr> |
| <tr class="memitem:af6705a49326de235df4e9b6028bdcdce"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph_1_1_in_place_operation_mutator.xhtml#af6705a49326de235df4e9b6028bdcdce">mutate</a> (<a class="el" href="classarm__compute_1_1graph_1_1_graph.xhtml">Graph</a> &g) override</td></tr> |
| <tr class="memdesc:af6705a49326de235df4e9b6028bdcdce"><td class="mdescLeft"> </td><td class="mdescRight">Walk the graph and perform a specific mutation. <a href="#af6705a49326de235df4e9b6028bdcdce">More...</a><br /></td></tr> |
| <tr class="separator:af6705a49326de235df4e9b6028bdcdce"><td class="memSeparator" colspan="2"> </td></tr> |
| <tr class="memitem:a0ee2c922a45715b33e30f83f8c005b68"><td class="memItemLeft" align="right" valign="top">const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph_1_1_in_place_operation_mutator.xhtml#a0ee2c922a45715b33e30f83f8c005b68">name</a> () override</td></tr> |
| <tr class="memdesc:a0ee2c922a45715b33e30f83f8c005b68"><td class="mdescLeft"> </td><td class="mdescRight">Returns mutator name. <a href="#a0ee2c922a45715b33e30f83f8c005b68">More...</a><br /></td></tr> |
| <tr class="separator:a0ee2c922a45715b33e30f83f8c005b68"><td class="memSeparator" colspan="2"> </td></tr> |
| <tr class="inherit_header pub_methods_classarm__compute_1_1graph_1_1_i_graph_mutator"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classarm__compute_1_1graph_1_1_i_graph_mutator')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classarm__compute_1_1graph_1_1_i_graph_mutator.xhtml">IGraphMutator</a></td></tr> |
| <tr class="memitem:a1054c29b61d56a4f33633230b844c4d8 inherit pub_methods_classarm__compute_1_1graph_1_1_i_graph_mutator"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classarm__compute_1_1graph_1_1_i_graph_mutator.xhtml#a1054c29b61d56a4f33633230b844c4d8">~IGraphMutator</a> ()=default</td></tr> |
| <tr class="memdesc:a1054c29b61d56a4f33633230b844c4d8 inherit pub_methods_classarm__compute_1_1graph_1_1_i_graph_mutator"><td class="mdescLeft"> </td><td class="mdescRight">Virtual Destructor. <a href="classarm__compute_1_1graph_1_1_i_graph_mutator.xhtml#a1054c29b61d56a4f33633230b844c4d8">More...</a><br /></td></tr> |
| <tr class="separator:a1054c29b61d56a4f33633230b844c4d8 inherit pub_methods_classarm__compute_1_1graph_1_1_i_graph_mutator"><td class="memSeparator" colspan="2"> </td></tr> |
| </table> |
| <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> |
| <div class="textblock"><p>Mutation pass to optimize operations that can be performed in-place. </p> |
| |
| <p class="definition">Definition at line <a class="el" href="_in_place_operation_mutator_8h_source.xhtml#l00034">34</a> of file <a class="el" href="_in_place_operation_mutator_8h_source.xhtml">InPlaceOperationMutator.h</a>.</p> |
| </div><h2 class="groupheader">Member Function Documentation</h2> |
| <a id="af6705a49326de235df4e9b6028bdcdce"></a> |
| <h2 class="memtitle"><span class="permalink"><a href="#af6705a49326de235df4e9b6028bdcdce">◆ </a></span>mutate()</h2> |
| |
| <div class="memitem"> |
| <div class="memproto"> |
| <table class="mlabels"> |
| <tr> |
| <td class="mlabels-left"> |
| <table class="memname"> |
| <tr> |
| <td class="memname">void mutate </td> |
| <td>(</td> |
| <td class="paramtype"><a class="el" href="classarm__compute_1_1graph_1_1_graph.xhtml">Graph</a> & </td> |
| <td class="paramname"><em>g</em></td><td>)</td> |
| <td></td> |
| </tr> |
| </table> |
| </td> |
| <td class="mlabels-right"> |
| <span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> |
| </tr> |
| </table> |
| </div><div class="memdoc"> |
| |
| <p>Walk the graph and perform a specific mutation. </p> |
| <dl class="params"><dt>Parameters</dt><dd> |
| <table class="params"> |
| <tr><td class="paramdir">[in,out]</td><td class="paramname">g</td><td><a class="el" href="classarm__compute_1_1graph_1_1_graph.xhtml" title="Graph class.">Graph</a> to walk and mutate </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implements <a class="el" href="classarm__compute_1_1graph_1_1_i_graph_mutator.xhtml#a5cbaa2df97059f21e84c1d4f3fef4694">IGraphMutator</a>.</p> |
| |
| <p class="definition">Definition at line <a class="el" href="_in_place_operation_mutator_8cpp_source.xhtml#l00038">38</a> of file <a class="el" href="_in_place_operation_mutator_8cpp_source.xhtml">InPlaceOperationMutator.cpp</a>.</p> |
| <div class="fragment"><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> {</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  std::set<NodeType> in_place_nodes = { <a class="code" href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16ad0146d2051fad860923cf31f7e00a732">NodeType::BatchNormalizationLayer</a>, <a class="code" href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16a041485a3394541feee82a34d40249d70">NodeType::ActivationLayer</a> };</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">// Not interested in the order of nodes</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">for</span>(<span class="keyword">auto</span> &node : g.nodes())</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>  {</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="keywordflow">if</span>(node && in_place_nodes.find(node->type()) != std::end(in_place_nodes))</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>  <span class="comment">// Get input edge</span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  Edge *input_edge = node->input_edge(0);</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span> </div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">// Check if parent has a single output if yes then force in place calculation else not</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  <span class="keywordflow">if</span>((input_edge != <span class="keyword">nullptr</span>) && (input_edge->producer() != <span class="keyword">nullptr</span>) && (input_edge->producer()->output_edges().size() == 1))</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  {</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">// Get current and new output tensors</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keyword">auto</span> current_output_tensor = node->output(0);</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="keyword">auto</span> new_output_tensor = input_edge->tensor();</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span> </div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <a class="code" href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a>(current_output_tensor == <span class="keyword">nullptr</span> || new_output_tensor == <span class="keyword">nullptr</span>);</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>  <span class="comment">// Prevent in-place operation if there is an accessor bound to the in-place tensor or quantization info are different</span></div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">if</span>(new_output_tensor->accessor() != <span class="keyword">nullptr</span> || current_output_tensor->desc().quant_info != new_output_tensor->desc().quant_info)</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  <a class="code" href="graph_2_logger_8h.xhtml#a300d153929a99c7b571d4cda3f7987a5">ARM_COMPUTE_LOG_GRAPH_VERBOSE</a>(<span class="stringliteral">"Prevented in-place operation as there is an accessor bound to the input tensor or the quantization info are different.\n"</span>);</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  }</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">else</span></div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  {</div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <a class="code" href="graph_2_logger_8h.xhtml#a300d153929a99c7b571d4cda3f7987a5">ARM_COMPUTE_LOG_GRAPH_VERBOSE</a>(<span class="stringliteral">"Switching to in-place computation for the node with ID : "</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  << node->id() << <span class="stringliteral">" and name : "</span> << node->name() << std::endl);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <span class="comment">// Update accessor</span></div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  new_output_tensor->set_accessor(current_output_tensor->extract_accessor());</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="comment">// Update output</span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  node->set_output_tensor(new_output_tensor->id(), 0);</div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  }</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  }</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  }</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  }</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> }</div><div class="ttc" id="namespacearm__compute_1_1graph_xhtml_acac9cbaeea226ed297804c012dc12b16a041485a3394541feee82a34d40249d70"><div class="ttname"><a href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16a041485a3394541feee82a34d40249d70">arm_compute::graph::NodeType::ActivationLayer</a></div></div> |
| <div class="ttc" id="namespacearm__compute_1_1graph_xhtml_acac9cbaeea226ed297804c012dc12b16ad0146d2051fad860923cf31f7e00a732"><div class="ttname"><a href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16ad0146d2051fad860923cf31f7e00a732">arm_compute::graph::NodeType::BatchNormalizationLayer</a></div></div> |
| <div class="ttc" id="_error_8h_xhtml_a54a6080c9f4df1f908e57a9bbb46f5da"><div class="ttname"><a href="_error_8h.xhtml#a54a6080c9f4df1f908e57a9bbb46f5da">ARM_COMPUTE_ERROR_ON</a></div><div class="ttdeci">#define ARM_COMPUTE_ERROR_ON(cond)</div><div class="ttdoc">If the condition is true then an error message is printed and an exception thrown.</div><div class="ttdef"><b>Definition:</b> <a href="_error_8h_source.xhtml#l00337">Error.h:337</a></div></div> |
| <div class="ttc" id="graph_2_logger_8h_xhtml_a300d153929a99c7b571d4cda3f7987a5"><div class="ttname"><a href="graph_2_logger_8h.xhtml#a300d153929a99c7b571d4cda3f7987a5">ARM_COMPUTE_LOG_GRAPH_VERBOSE</a></div><div class="ttdeci">#define ARM_COMPUTE_LOG_GRAPH_VERBOSE(x)</div><div class="ttdef"><b>Definition:</b> <a href="graph_2_logger_8h_source.xhtml#l00050">Logger.h:50</a></div></div> |
| </div><!-- fragment --> |
| <p class="reference">References <a class="el" href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16a041485a3394541feee82a34d40249d70">arm_compute::graph::ActivationLayer</a>, <a class="el" href="_error_8h_source.xhtml#l00337">ARM_COMPUTE_ERROR_ON</a>, <a class="el" href="graph_2_logger_8h_source.xhtml#l00050">ARM_COMPUTE_LOG_GRAPH_VERBOSE</a>, <a class="el" href="namespacearm__compute_1_1graph.xhtml#acac9cbaeea226ed297804c012dc12b16ad0146d2051fad860923cf31f7e00a732">arm_compute::graph::BatchNormalizationLayer</a>, <a class="el" href="_graph_8cpp_source.xhtml#l00174">Graph::nodes()</a>, <a class="el" href="_i_node_8cpp_source.xhtml#l00132">INode::output_edges()</a>, <a class="el" href="_edge_8h_source.xhtml#l00084">Edge::producer()</a>, and <a class="el" href="_edge_8h_source.xhtml#l00116">Edge::tensor()</a>.</p> |
| |
| </div> |
| </div> |
| <a id="a0ee2c922a45715b33e30f83f8c005b68"></a> |
| <h2 class="memtitle"><span class="permalink"><a href="#a0ee2c922a45715b33e30f83f8c005b68">◆ </a></span>name()</h2> |
| |
| <div class="memitem"> |
| <div class="memproto"> |
| <table class="mlabels"> |
| <tr> |
| <td class="mlabels-left"> |
| <table class="memname"> |
| <tr> |
| <td class="memname">const char * name </td> |
| <td>(</td> |
| <td class="paramname"></td><td>)</td> |
| <td></td> |
| </tr> |
| </table> |
| </td> |
| <td class="mlabels-right"> |
| <span class="mlabels"><span class="mlabel">override</span><span class="mlabel">virtual</span></span> </td> |
| </tr> |
| </table> |
| </div><div class="memdoc"> |
| |
| <p>Returns mutator name. </p> |
| <dl class="section return"><dt>Returns</dt><dd>Mutator name </dd></dl> |
| |
| <p>Implements <a class="el" href="classarm__compute_1_1graph_1_1_i_graph_mutator.xhtml#a3690f13206df6f6103bae8ae3ceee528">IGraphMutator</a>.</p> |
| |
| <p class="definition">Definition at line <a class="el" href="_in_place_operation_mutator_8cpp_source.xhtml#l00033">33</a> of file <a class="el" href="_in_place_operation_mutator_8cpp_source.xhtml">InPlaceOperationMutator.cpp</a>.</p> |
| <div class="fragment"><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>  <span class="keywordflow">return</span> <span class="stringliteral">"InPlaceOperationMutator"</span>;</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span> }</div></div><!-- fragment --> |
| </div> |
| </div> |
| <hr/>The documentation for this class was generated from the following files:<ul> |
| <li>arm_compute/graph/mutators/<a class="el" href="_in_place_operation_mutator_8h_source.xhtml">InPlaceOperationMutator.h</a></li> |
| <li>src/graph/mutators/<a class="el" href="_in_place_operation_mutator_8cpp_source.xhtml">InPlaceOperationMutator.cpp</a></li> |
| </ul> |
| </div><!-- contents --> |
| </div><!-- doc-content --> |
| <!-- start footer part --> |
| <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| <ul> |
| <li class="navelem"><a class="el" href="namespacearm__compute.xhtml">arm_compute</a></li><li class="navelem"><a class="el" href="namespacearm__compute_1_1graph.xhtml">graph</a></li><li class="navelem"><a class="el" href="classarm__compute_1_1graph_1_1_in_place_operation_mutator.xhtml">InPlaceOperationMutator</a></li> |
| <li class="footer">Generated on Mon Sep 2 2019 11:47:39 for Compute Library by |
| <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li> |
| </ul> |
| </div> |
| </body> |
| </html> |