<ahref="../../d5/d36/cudnn__frontend__Filters_8h.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aname="l00001"></a><spanclass="lineno"> 1</span> <spanclass="comment">/*</span></div><divclass="line"><aname="l00002"></a><spanclass="lineno"> 2</span> <spanclass="comment"> * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.</span></div><divclass="line"><aname="l00003"></a><spanclass="lineno"> 3</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00004"></a><spanclass="lineno"> 4</span> <spanclass="comment"> * Permission is hereby granted, free of charge, to any person obtaining a</span></div><divclass="line"><aname="l00005"></a><spanclass="lineno"> 5</span> <spanclass="comment"> * copy of this software and associated documentation files (the "Software"),</span></div><divclass="line"><aname="l00006"></a><spanclass="lineno"> 6</span> <spanclass="comment"> * to deal in the Software without restriction, including without limitation</span></div><divclass="line"><aname="l00007"></a><spanclass="lineno"> 7</span> <spanclass="comment"> * the rights to use, copy, modify, merge, publish, distribute, sublicense,</span></div><divclass="line"><aname="l00008"></a><spanclass="lineno"> 8</span> <spanclass="comment"> * and/or sell copies of the Software, and to permit persons to whom the</span></div><divclass="line"><aname="l00009"></a><spanclass="lineno"> 9</span> <spanclass="comment"> * Software is furnished to do so, subject to the following conditions:</span></div><divclass="line"><aname="l00010"></a><spanclass="lineno"> 10</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00011"></a><spanclass="lineno"> 11</span> <spanclass="comment"> * The above copyright notice and this permission notice shall be included in</span></div><divclass="line"><aname="l00012"></a><spanclass="lineno"> 12</span> <spanclass="comment"> * all copies or substantial portions of the Software.</span></div><divclass="line"><aname="l00013"></a><spanclass="lineno"> 13</span> <spanclass="comment"> *</span></div><divclass="line"><aname="l00014"></a><spanclass="lineno"> 14</span> <spanclass="comment"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span></div><divclass="line"><aname="l00015"></a><spanclass="lineno"> 15</span> <spanclass="comment"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span></div><divclass="line"><aname="l00016"></a><spanclass="lineno"> 16</span> <spanclass="comment"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL</span></div><divclass="line"><aname="l00017"></a><spanclass="lineno"> 17</span> <spanclass="comment"> * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span></div><divclass="line"><aname="l00018"></a><spanclass="lineno"> 18</span> <spanclass="comment"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING</span></div><divclass="line"><aname="l00019"></a><spanclass="lineno"> 19</span> <spanclass="comment"> * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER</span></div><divclass="line"><aname="l00020"></a><spanclass="lineno"> 20</span> <spanclass="comment"> * DEALINGS IN THE SOFTWARE.</span></div><divclass="line"><aname="l00021"></a><spanclass="lineno"> 21</span> <spanclass="comment"> */</span></div><divclass="line"><aname="l00022"></a><spanclass="lineno"> 22</span> </div><divclass="line"><aname="l00023"></a><spanclass="lineno"> 23</span> <spanclass="preprocessor">#pragma once</span></div><divclass="line"><aname="l00024"></a><spanclass="lineno"> 24</span> </div><divclass="line"><aname="l00025"></a><spanclass="lineno"> 25</span> <spanclass="preprocessor">#include <cudnn.h></span></div><divclass="line"><aname="l00026"></a><spanclass="lineno"> 26</span> </div><divclass="line"><aname="l00027"></a><spanclass="lineno"> 27</span> <spanclass="keyword">namespace </span><aclass="code"href="../../df/de1/namespacecudnn__frontend.html">cudnn_frontend</a> {</div><divclass="line"><aname="l00028"></a><spanclass="lineno"> 28</span> </div><divclass="line"><aname="l00029"></a><spanclass="lineno"> 29</span> <spanclass="comment">// If filter_fn returns true</span></div><divclass="line"><aname="l00030"></a><spanclass="lineno"> 30</span> <spanclass="comment">// The engine config will be filtered out and will</span></div><divclass="line"><aname="l00031"></a><spanclass="lineno"> 31</span> <spanclass="comment">// not be part of the to list.</span></div><divclass="line"><aname="l00032"></a><spanclass="lineno"> 32</span> <spanclass="keyword">static</span><spanclass="keywordtype">void</span></div><divclass="line"><aname="l00033"></a><spanclass="lineno"><aclass="line"href="../../df/de1/namespacecudnn__frontend.html#a4d18e44a57e30f9bf29157f742ba9c65"> 33</a></span> <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#abcaf76bd6c7d8c59082fd53d2a8c897a">filter</a>(<aclass="code"href="../../df/de1/namespacecudnn__frontend.html#a84a5f004bdf17747bf7cf45d6fc754cd">EngineConfigList</a>&from, <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#a84a5f004bdf17747bf7cf45d6fc754cd">EngineConfigList</a>&to, std::function<<spanclass="keywordtype">bool</span>(cudnnBackendDescriptor_t)> filter_fn) {</div><divclass="line"><aname="l00034"></a><spanclass="lineno"> 34</span> <spanclass="keyword">auto</span> p = std::stable_partition(from.begin(), from.end(), [filter_fn](<aclass="code"href="../../df/de1/namespacecudnn__frontend.html#ac94d582cdfa2adf3d68a4e675e5d69aa">ManagedOpaqueDescriptor</a>&p) {</div><divclass="line"><aname="l00035"></a><spanclass="lineno"> 35</span> <spanclass="keywordflow">return</span> filter_fn(const_cast<cudnnBackendDescriptor_t>(p->get_backend_descriptor()));</div><divclass="line"><aname="l00036"></a><spanclass="lineno"> 36</span>  });</div><divclass="line"><aname="l00037"></a><spanclass="lineno"> 37</span> <spanclass="comment">// range insert with move</span></div><divclass="line"><aname="l00038"></a><spanclass="lineno"> 38</span>  to.insert(to.end(), std::make_move_iterator(p), std::make_move_iterator(from.end()));</div><divclass="line"><aname="l00039"></a><spanclass="lineno"> 39</span> <spanclass="comment">// erase the moved-from elements.</span></div><divclass="line"><aname="l00040"></a><spanclass="lineno"> 40</span>  from.erase(p, from.end());</div><divclass="line"><aname="l00041"></a><spanclass="lineno"> 41</span> }</div><divclass="line"><aname="l00042"></a><spanclass="lineno"> 42</span> </div><divclass="line"><aname="l00043"></a><spanclass="lineno"> 43</span> <spanclass="keyword">template</span><cudnnBackendNumericalNote_t NUMERIC_NOTE></div><divclass="line"><aname="l00044"></a><spanclass="lineno"> 44</span> <spanclass="keywordtype">bool</span></div><divclass="line"><aname="l00045"></a><spanclass="lineno"><aclass="line"href="../../df/de1/namespacecudnn__frontend.html#a75bb541476d93b039f5fd9f9d29242e6"> 45</a></span> <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#a75bb541476d93b039f5fd9f9d29242e6">hasNumericalNote</a>(cudnnBackendDescriptor_t engine_config) {</div><divclass="line"><aname="l00046"></a><spanclass="lineno"> 46</span> <spanclass="keywordtype">bool</span> hasNumerics = <spanclass="keyword">false</span>;</div><divclass="line"><aname="l00047"></a><spanclass="lineno"> 47</span> <spanclass="keyword">auto</span> status = CUDNN_STATUS_SUCCESS;</div><divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#ac94d582cdfa2adf3d68a4e675e5d69aa">ManagedOpaqueDescriptor</a> engine = <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#aee9c79eb8972c944de14ccd70bf5db43">make_shared_backend_pointer</a>(CUDNN_BACKEND_ENGINE_DESCRIPTOR);</div><divclass="line"><aname="l00049"></a><spanclass="lineno"> 49</span>  cudnnBackendDescriptor_t engine_ = engine->get_backend_descriptor();</div><divclass="line"><aname="l00050"></a><spanclass="lineno"> 50</span>  int64_t engine_count = -1;</div><divclass="line"><aname="l00051"></a><spanclass="lineno"> 51</span>  status = cudnnBackendGetAttribute(</div><divclass="line"><aname="l00052"></a><spanclass="lineno"> 52</span>  engine_config, CUDNN_ATTR_ENGINECFG_ENGINE, CUDNN_TYPE_BACKEND_DESCRIPTOR, 1, &engine_count, &engine_);</div><divclass="line"><aname="l00053"></a><spanclass="lineno"> 53</span> <spanclass="keywordflow">if</span> (status == CUDNN_STATUS_SUCCESS) {</div><divclass="line"><aname="l00054"></a><spanclass="lineno"> 54</span>  cudnnBackendNumericalNote_t notes[CUDNN_NUMERICAL_NOTE_TYPE_COUNT];</div><divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span>  int64_t elem_count = 0;</div><divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span>  cudnnBackendGetAttribute(engine->get_backend_descriptor(),</div><divclass="line"><aname="l00057"></a><spanclass="lineno"> 57</span>  CUDNN_ATTR_ENGINE_NUMERICAL_NOTE,</div><divclass="line"><aname="l00058"></a><spanclass="lineno"> 58</span>  CUDNN_TYPE_NUMERICAL_NOTE,</div><divclass="line"><aname="l00059"></a><spanclass="lineno"> 59</span>  CUDNN_NUMERICAL_NOTE_TYPE_COUNT,</div><divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span> &elem_count,</div><divclass="line"><aname="l00061"></a><spanclass="lineno"> 61</span>  notes);</div><divclass="line"><aname="l00062"></a><spanclass="lineno"> 62</span> <spanclass="keywordflow">if</span> (std::any_of(</div><divclass="line"><aname="l00063"></a><spanclass="lineno"> 63</span>  notes, notes + elem_count, [](cudnnBackendNumericalNote_t note) { <spanclass="keywordflow">return</span> note == NUMERIC_NOTE; })) {</div><divclass="line"><aname="l00064"></a><spanclass="lineno"> 64</span>  hasNumerics = <spanclass="keyword">true</span>;</div><divclass="line"><aname="l00065"></a><spanclass="lineno"> 65</span>  }</div><divclass="line"><aname="l00066"></a><spanclass="lineno"> 66</span>  }</div><divclass="line"><aname="l00067"></a><spanclass="lineno"> 67</span> <spanclass="keywordflow">return</span> hasNumerics;</div><divclass="line"><aname="l00068"></a><spanclass="lineno"> 68</span> }</div><divclass="line"><aname="l00069"></a><spanclass="lineno"> 69</span> </div><divclass="line"><aname="l00070"></a><spanclass="lineno"> 70</span> <spanclass="preprocessor">#if (CUDNN_VERSION >= 8200)</span></div><divclass="line"><aname="l00071"></a><spanclass="lineno"> 71</span> <spanclass="keyword">template</span><cudnnBackendBehaviorNote_t BEHAVIOR_NOTE></div><divclass="line"><aname="l00072"></a><spanclass="lineno"> 72</span> <spanclass="keywordtype">bool</span></div><divclass="line"><aname="l00073"></a><spanclass="lineno"> 73</span> hasBehaviorNote(cudnnBackendDescriptor_t engine_config) {</div><divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="keywordtype">bool</span> hasBehavior = <spanclass="keyword">false</span>;</div><divclass="line"><aname="l00075"></a><spanclass="lineno"> 75</span> <spanclass="keyword">auto</span> status = CUDNN_STATUS_SUCCESS;</div><divclass="line"><aname="l00076"></a><spanclass="lineno"> 76</span> <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#ac94d582cdfa2adf3d68a4e675e5d69aa">ManagedOpaqueDescriptor</a> engine = <aclass="code"href="../../df/de1/namespacecudnn__frontend.html#aee9c79eb8972c944de14ccd70bf5db43">make_shared_backend_pointer</a>(CUDNN_BACKEND_ENGINE_DESCRIPTOR);</div><divclass="line"><aname="l00077"></a><spanclass="lineno"> 77</span>  cudnnBackendDescriptor_t engine_ = engine->get_backend_descriptor();</div><divclass="line"><aname="l00078"></a><spanclass="lineno"> 78</span>  int64_t engine_count = -1;</div><divclass="line"><aname="l00079"></a><spanclass="lineno"> 79</span>  status = cudnnBackendGetAttribute(</div><divclass="line"><aname="l00080"></a><spanclass="lineno"> 80</span>  engine_config, CUDNN_ATTR_ENGINECFG_ENGINE, CUDNN_TYPE_BACKEND_DESCRIPTOR, 1, &engine_count, &engine_);</div><divclass="line"><aname="l00081"></a><spanclass="lineno"> 81</span> <spanclass="keywordflow">if</span> (status == CUDNN_STATUS_SUCCESS) {</div><divclass="line"><aname="l00082"></a><spanclass="lineno"> 82</span>  cudnnBackendBehaviorNote_t notes[CUDNN_BEHAVIOR_NOTE_TYPE_COUNT];</div><divclass="line"><aname="l00083"></a><spanclass="lineno"> 83</span>  int64_t elem_count = 0;</div><divclass="line"><aname="l00084"></a><spanclass="lineno"> 84</span>  cudnnBackendGetAttribute(engine->get_backend_descriptor(),</div><divclass="line"><aname="l00085"></a><spanclass="lineno"> 85</span>  CUDNN_ATTR_ENGINE_BEHAVIOR_NOTE,</div><divclass="line"><aname="l00086"></a><spanclass="lineno"> 86</span>  CUDNN_TYPE_BEHAVIOR_NOTE,</div><divclass="line"><aname="l00087"></a><spanclass="lineno"> 87</span>  CUDNN_BEHAVIOR_NOTE_TYPE_COUNT,</div><divclass="line"><aname="l00088"></a><spanclass="lineno"> 88</span> &elem_count,</div><divclass="line"><aname="l00089"></a><spanclass="lineno"> 89</span>  notes);</div><divclass="line"><aname="l00090"></a><spanclass="lineno"> 90</span> <spanclass="keywordflow">if</span> (std::any_of(</div><divclass="line"><aname="l00091"></a><spanclass="lineno"> 91</span>  notes, notes + elem_count, [](cudnnBackendBehaviorNote_t note) { <spanclass="keywordflow">return</span> note == BEHAVIOR_NOTE; })) {</div><divclass="line"><aname="l00092"></a><spanclass="lineno"> 92</span>  hasBehavior = <spanclass="keyword">true</span>;</div><divclass="line"><aname="l00093"></a><spanclass="lineno"> 93</span>  }</div><divclass="line"><aname="l00094"></a><spanclass="lineno"> 94</span>  }</div><divclass="line"><aname="l00095"></a><spanclass="lineno"> 95</span> <spanclass="keywordflow">return</span> hasBehavior;</div><divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span> }</div><divclass="line"><aname="l00097"></a><spanclass="lineno"> 97</span> <spanclass="preprocessor">#endif</span></div><divclass="line"><aname="l00098"></a><spanclass="lineno"> 98</span> }</div><divclass="ttc"id="namespacecudnn__frontend_html_abcaf76bd6c7d8c59082fd53d2a8c897a"><divclass="ttname"><ahref="../../df/de1/namespacecudnn__frontend.html#abcaf76bd6c7d8c59082fd53d2a8c897a">cudnn_frontend::filter</a></div><divclass="ttdeci">static auto filter(Predicate pred, executionPlans_t &plans) -> executionPlans_t</div><divclass="ttdef"><b>Definition:</b><ahref="../../de/d1e/cudnn__frontend__EngineConfigGenerator_8h_source.html#l00106">cudnn_frontend_EngineConfigGenerator.h:106</a></div></div>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l04484">4484</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div><h2class="groupheader">Member Function Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l04487">4487</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
<areashape="rect"id="node2"href="../../d5/d3c/structnlohmann_1_1detail_1_1iterator__types.html"title="{nlohmann::detail::iterator\l_types\< T \>\n||}"alt=""coords="5,160,171,252"/>
<areashape="rect"id="node3"href="../../d5/da3/structnlohmann_1_1detail_1_1iterator__traits_3_01T_00_01enable__if__t_3_01_9std_1_1is__pointer_3_01T_01_4_1_1value_01_4_01_4.html"title="{nlohmann::detail::iterator\l_traits\< T, enable_if_t\l\< !std::is_pointer\< T \>::\lvalue \> \>\n||}"alt=""coords="5,301,171,423"/>
</map>
</div>
<divclass="dynheader">
Collaboration diagram for nlohmann::detail::iterator_types< It, typename >:</div>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l03223">3223</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div><hr/>The documentation for this struct was generated from the following file:<ul>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l04248">4248</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div><h2class="groupheader">Member Function Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l04251">4251</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
<trclass="memitem:af6a22d4210bb7bc2da66021300ddd6db"><tdclass="memItemLeft"align="right"valign="top"><aclass="el"href="../../dc/df0/namespacenlohmann_1_1detail.html#a59fca69799f6b9e366710cb9043aa77d">void</a> </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../d5/d66/classnlohmann_1_1detail_1_1output__vector__adapter.html#af6a22d4210bb7bc2da66021300ddd6db">write_character</a> (CharType c) override</td></tr>
<trclass="inherit_header pub_methods_structnlohmann_1_1detail_1_1output__adapter__protocol"><tdcolspan="2"onclick="javascript:toggleInherit('pub_methods_structnlohmann_1_1detail_1_1output__adapter__protocol')"><imgsrc="../../closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="../../dc/d9b/structnlohmann_1_1detail_1_1output__adapter__protocol.html">nlohmann::detail::output_adapter_protocol< CharType ></a></td></tr>
class nlohmann::detail::output_vector_adapter< CharType ></h3>
<p>output adapter for byte vectors </p>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l13155">13155</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div><h2class="groupheader">Constructor & Destructor Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l13158">13158</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l13162">13162</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l13168">13168</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div>
</div>
<h2class="groupheader">Member Data Documentation</h2>
<pclass="definition">Definition at line <aclass="el"href="../../d5/db8/json_8hpp_source.html#l13174">13174</a> of file <aclass="el"href="../../d5/db8/json_8hpp_source.html">json.hpp</a>.</p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>