optimizer.html 187.0 KB
Newer Older
Y
Yu Yang 已提交
1 2 3 4 5 6 7 8
<!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/html; charset=utf-8" />
    
9
    <title>Optimizer &#8212; PaddlePaddle  documentation</title>
Y
Yu Yang 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    
    <link rel="stylesheet" href="../../../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
    <link rel="top" title="PaddlePaddle  documentation" href="../../../index.html" />
    <link rel="up" title="Parameter Documents" href="index.html" />
    <link rel="next" title="Client Documents" href="../../pserver/client/index.html" />
    <link rel="prev" title="Parameter Documents" href="index.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../pserver/client/index.html" title="Client Documents"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Parameter Documents"
             accesskey="P">previous</a> |</li>
48 49 50
        <li class="nav-item nav-item-0"><a href="../../../index.html">PaddlePaddle  documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Source Code Documents</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U">Parameter Documents</a> &#187;</li> 
Y
Yu Yang 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="optimizer">
<h1>Optimizer<a class="headerlink" href="#optimizer" title="Permalink to this headline"></a></h1>
<dl class="type">
<dt id="_CPPv26paddle">
<span id="paddle"></span><span class="target" id="paddlenamespacepaddle"></span><em class="property">namespace </em><code class="descname">paddle</code><a class="headerlink" href="#_CPPv26paddle" title="Permalink to this definition"></a></dt>
<dd><dl class="class">
65 66 67
<dt id="_CPPv2N6paddle12SgdOptimizerE">
<span id="paddle::SgdOptimizer"></span><span class="target" id="paddleclasspaddle_1_1SgdOptimizer"></span><em class="property">class </em><code class="descname">SgdOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle12SgdOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
68 69 70
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
71 72
<dt id="_CPPv2N6paddle12SgdOptimizer12SgdOptimizerERK18OptimizationConfig">
<span id="paddle::SgdOptimizer::SgdOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1SgdOptimizer_1ace10e4aa494c4d3c2b57cb7e00a37d2e"></span><code class="descname">SgdOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle12SgdOptimizer12SgdOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
73 74 75
<dd></dd></dl>

<dl class="function">
76 77
<dt id="_CPPv2N6paddle12SgdOptimizer10startBatchE7int64_t">
<span id="paddle::SgdOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1SgdOptimizer_1a1314d9cce634862f4d00d5d80f4e9b5a"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle12SgdOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
78 79 80 81
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
<dt id="_CPPv2N6paddle12SgdOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::SgdOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1SgdOptimizer_1a43747e1c849291a35b7951d12b51152f"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle12SgdOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1SgdOptimizer_1a1314d9cce634862f4d00d5d80f4e9b5a"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1SgdOptimizer_1ae83ffdcf2827703678bc9332cc2620ca"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1SgdOptimizer_1a43747e1c849291a35b7951d12b51152f"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle12SgdOptimizer11finishBatchEv">
<span id="paddle::SgdOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1SgdOptimizer_1ae83ffdcf2827703678bc9332cc2620ca"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle12SgdOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizerE">
<span id="paddle::SparseMomentumParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer"></span><em class="property">class </em><code class="descname">SparseMomentumParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer32SparseMomentumParameterOptimizerERK18OptimizationConfig">
<span id="paddle::SparseMomentumParameterOptimizer::SparseMomentumParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1af98463e550528151d72900df6cdb3cf0"></span><code class="descname">SparseMomentumParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer32SparseMomentumParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::SparseMomentumParameterOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a31abb97bf4cf9de214c8f734a4f8e6d7"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1afc2509f80468f5e681f76e7f77241abc"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer10startBatchE7int64_t">
<span id="paddle::SparseMomentumParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1afc2509f80468f5e681f76e7f77241abc"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::SparseMomentumParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1ac04e4548c8df279090446d3e5ed7f290"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1afc2509f80468f5e681f76e7f77241abc"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1aa50f912ed13bdc65f038ac4e64693171"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1ac04e4548c8df279090446d3e5ed7f290"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::SparseMomentumParameterOptimizer::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a76e55e874bccd874d8b57122c43285a2"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer11finishBatchEv">
<span id="paddle::SparseMomentumParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1aa50f912ed13bdc65f038ac4e64693171"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
Y
Yu Yang 已提交
159 160 161 162 163 164
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
165 166
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer6timer_E">
<span id="paddle::SparseMomentumParameterOptimizer::timer___int64_t"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a47850cc8eb54a06f82c10cdd9481f468"></span>int64_t <code class="descname">timer_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer6timer_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
167 168 169
<dd></dd></dl>

<dl class="member">
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer6t0Vec_E">
<span id="paddle::SparseMomentumParameterOptimizer::t0Vec___std::vector:int64_t:"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a2f62cc8ed56d29b82174c8115014a734"></span>std::vector&lt;int64_t&gt; <code class="descname">t0Vec_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer6t0Vec_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer18isParameterSparse_E">
<span id="paddle::SparseMomentumParameterOptimizer::isParameterSparse___b"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a88b594dedf775a5087c2bb76b4aeb563"></span>bool <code class="descname">isParameterSparse_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer18isParameterSparse_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Private Members</p>
<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer6alpha_E">
<span id="paddle::SparseMomentumParameterOptimizer::alpha___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1aa20b1003ec8f8a6a4477135eb05a03a6"></span>real <code class="descname">alpha_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer6alpha_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer5beta_E">
<span id="paddle::SparseMomentumParameterOptimizer::beta___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a16b68c9918e5c2dd3a45d3bc2646cf90"></span>real <code class="descname">beta_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer5beta_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer4tau_E">
<span id="paddle::SparseMomentumParameterOptimizer::tau___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a9d77b38bce2daa300704e1969c028b3c"></span>real <code class="descname">tau_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer4tau_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer6gamma_E">
<span id="paddle::SparseMomentumParameterOptimizer::gamma___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1aef195f2e394bde2a67720e6eb2bb6f2f"></span>real <code class="descname">gamma_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer6gamma_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer10threshold_E">
<span id="paddle::SparseMomentumParameterOptimizer::threshold___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1ac6e57aee1b82328166da7bb8e67f2710"></span>real <code class="descname">threshold_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer10threshold_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer9momentum_E">
<span id="paddle::SparseMomentumParameterOptimizer::momentum___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a24fd95d6b9e88c89b69502c5ed49903f"></span>real <code class="descname">momentum_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer9momentum_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32SparseMomentumParameterOptimizer10decayRate_E">
<span id="paddle::SparseMomentumParameterOptimizer::decayRate___real"></span><span class="target" id="paddleclasspaddle_1_1SparseMomentumParameterOptimizer_1a62739397435f9cbfbcf1fb2097eb86c0"></span>real <code class="descname">decayRate_</code><a class="headerlink" href="#_CPPv2N6paddle32SparseMomentumParameterOptimizer10decayRate_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
215 216 217 218 219 220 221 222
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizerE">
<span id="paddle::AdagradParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer"></span><em class="property">class </em><code class="descname">AdagradParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizerE" title="Permalink to this definition"></a></dt>
223
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer25AdagradParameterOptimizerERK18OptimizationConfig">
<span id="paddle::AdagradParameterOptimizer::AdagradParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1a44d8d7ecf0f9ee180b9a2f7be51ebbfd"></span><code class="descname">AdagradParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer25AdagradParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer10startBatchE7int64_t">
<span id="paddle::AdagradParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1a27e757f4c30f64907a3b3b954cd18d91"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AdagradParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1ae0cca3ea6ec4bca219b84ced8692d844"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
240
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1AdagradParameterOptimizer_1a27e757f4c30f64907a3b3b954cd18d91"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdagradParameterOptimizer_1ae0cca3ea6ec4bca219b84ced8692d844"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
241 242 243 244 245 246
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::AdagradParameterOptimizer::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1a047d95ae4dc46f9c9918d637d8fddd2e"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer11numUpdates_E">
<span id="paddle::AdagradParameterOptimizer::numUpdates___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1ae580d9c874096cc05e9c1c7827277a47"></span>int64_t <code class="descname">numUpdates_</code><a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer11numUpdates_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Static Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle25AdagradParameterOptimizer18kMaxNumAccumulatesE">
<span id="paddle::AdagradParameterOptimizer::kMaxNumAccumulates__int64_tC"></span><span class="target" id="paddleclasspaddle_1_1AdagradParameterOptimizer_1a9ee3473a414c4d811fef82db4fcec9a5"></span><em class="property">const</em> int64_t <code class="descname">kMaxNumAccumulates</code><a class="headerlink" href="#_CPPv2N6paddle25AdagradParameterOptimizer18kMaxNumAccumulatesE" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
293 294 295
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizerE">
<span id="paddle::AdaDeltaParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer"></span><em class="property">class </em><code class="descname">AdaDeltaParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
296 297 298
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
299 300
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizer26AdaDeltaParameterOptimizerERK18OptimizationConfig">
<span id="paddle::AdaDeltaParameterOptimizer::AdaDeltaParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a704794479c4284b982120e09de2d71b3"></span><code class="descname">AdaDeltaParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizer26AdaDeltaParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
301 302 303
<dd></dd></dl>

<dl class="function">
304 305 306
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizer10startBatchE7int64_t">
<span id="paddle::AdaDeltaParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a891099512f6c045832cdd284db481fc5"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
Y
Yu Yang 已提交
307 308 309
</dd></dl>

<dl class="function">
310 311 312
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AdaDeltaParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a61e7f6a2ea8903c86606b39b28ba19f6"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a891099512f6c045832cdd284db481fc5"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a61e7f6a2ea8903c86606b39b28ba19f6"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
313 314 315 316 317 318
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
319 320
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizer4rou_E">
<span id="paddle::AdaDeltaParameterOptimizer::rou___real"></span><span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a1f132593ac4c3444ec539cb8eee920e7"></span>real <code class="descname">rou_</code><a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizer4rou_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
321 322 323
<dd></dd></dl>

<dl class="member">
324 325
<dt id="_CPPv2N6paddle26AdaDeltaParameterOptimizer8epsilon_E">
<span id="paddle::AdaDeltaParameterOptimizer::epsilon___real"></span><span class="target" id="paddleclasspaddle_1_1AdaDeltaParameterOptimizer_1a5813d5471be663283619d92e071bafba"></span>real <code class="descname">epsilon_</code><a class="headerlink" href="#_CPPv2N6paddle26AdaDeltaParameterOptimizer8epsilon_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
326 327 328 329 330 331
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
332 333 334
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizerE">
<span id="paddle::RMSPropParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer"></span><em class="property">class </em><code class="descname">RMSPropParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
335 336 337
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
338 339
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer25RMSPropParameterOptimizerERK18OptimizationConfig">
<span id="paddle::RMSPropParameterOptimizer::RMSPropParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a5bdf33f8d783101bed10fb7d86853863"></span><code class="descname">RMSPropParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer25RMSPropParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
340 341 342
<dd></dd></dl>

<dl class="function">
343 344 345 346 347 348 349 350 351 352 353 354 355 356
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::RMSPropParameterOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a6de48d61f6b93ecacdb697ee1ac0390d"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1RMSPropParameterOptimizer_1a2cc69151ebac285798af757530577c0a"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer10startBatchE7int64_t">
<span id="paddle::RMSPropParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a2cc69151ebac285798af757530577c0a"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer11finishBatchEv">
<span id="paddle::RMSPropParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a13f54bed32eb4318cd06c8ec761408c4"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
357 358 359 360
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
361 362 363
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::RMSPropParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1ae973aa5db1b2762fa9bba75f5881eae2"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1RMSPropParameterOptimizer_1a2cc69151ebac285798af757530577c0a"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1RMSPropParameterOptimizer_1a13f54bed32eb4318cd06c8ec761408c4"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1RMSPropParameterOptimizer_1ae973aa5db1b2762fa9bba75f5881eae2"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
364 365 366 367 368 369
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
370 371
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer4rou_E">
<span id="paddle::RMSPropParameterOptimizer::rou___real"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1ad8c5bd2f6f31bc17eda173c765cb38de"></span>real <code class="descname">rou_</code><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer4rou_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
372 373 374
<dd></dd></dl>

<dl class="member">
375 376
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer8epsilon_E">
<span id="paddle::RMSPropParameterOptimizer::epsilon___real"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a190fb382a11764a8dec2948c2f5681dc"></span>real <code class="descname">epsilon_</code><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer8epsilon_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
377 378 379
<dd></dd></dl>

<dl class="member">
380 381 382
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer6timer_E">
<span id="paddle::RMSPropParameterOptimizer::timer___int64_t"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1af916ade6351cca49473b690446875da5"></span>int64_t <code class="descname">timer_</code><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer6timer_E" title="Permalink to this definition"></a></dt>
<dd><p>counting batches, donot need catch up with t(timer_) is current time, t0(t0Vec_) are last occur time of i rows. if one block is update by multi threads, caller should hash sparse ids to avoid write conflict in t0Vec_. </p>
Y
Yu Yang 已提交
383 384
</dd></dl>

385 386 387
<dl class="member">
<dt id="_CPPv2N6paddle25RMSPropParameterOptimizer6t0Vec_E">
<span id="paddle::RMSPropParameterOptimizer::t0Vec___std::vector:int64_t:"></span><span class="target" id="paddleclasspaddle_1_1RMSPropParameterOptimizer_1a449be6d175fae53f41c6222caa5b229f"></span>std::vector&lt;int64_t&gt; <code class="descname">t0Vec_</code><a class="headerlink" href="#_CPPv2N6paddle25RMSPropParameterOptimizer6t0Vec_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
388 389 390 391 392 393 394 395
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizerE">
<span id="paddle::DecayedAdagradParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer"></span><em class="property">class </em><code class="descname">DecayedAdagradParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizerE" title="Permalink to this definition"></a></dt>
396
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
397 398 399 400 401 402 403 404 405 406
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer32DecayedAdagradParameterOptimizerERK18OptimizationConfig">
<span id="paddle::DecayedAdagradParameterOptimizer::DecayedAdagradParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a23610e6517b21b9a042426218e923614"></span><code class="descname">DecayedAdagradParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer32DecayedAdagradParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::DecayedAdagradParameterOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a4c0b67d1ede0cbf2692ff82e290d66c4"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
407
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a257cbda1bddfb34b82ef8a5f742f48db"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer10startBatchE7int64_t">
<span id="paddle::DecayedAdagradParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a257cbda1bddfb34b82ef8a5f742f48db"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer11finishBatchEv">
<span id="paddle::DecayedAdagradParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a909a5d8e0ec5eff18186fa764ad8da49"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::DecayedAdagradParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a4548400c59d03b2c7d7b2438de1b2775"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
425
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a257cbda1bddfb34b82ef8a5f742f48db"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a909a5d8e0ec5eff18186fa764ad8da49"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a4548400c59d03b2c7d7b2438de1b2775"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer4rou_E">
<span id="paddle::DecayedAdagradParameterOptimizer::rou___real"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a700d7fa479ddbc913b483fabd04405ea"></span>real <code class="descname">rou_</code><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer4rou_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer8epsilon_E">
<span id="paddle::DecayedAdagradParameterOptimizer::epsilon___real"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a05bc4f758e4798daf0ba3b68f8321435"></span>real <code class="descname">epsilon_</code><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer8epsilon_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer6timer_E">
<span id="paddle::DecayedAdagradParameterOptimizer::timer___int64_t"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1ad09bf344ddd64d0990de6b3a96c58b59"></span>int64_t <code class="descname">timer_</code><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer6timer_E" title="Permalink to this definition"></a></dt>
<dd><p>counting batches, donot need catch up with t(timer_) is current time, t0(t0Vec_) are last occur time of i rows. if one block is update by multi threads, caller should hash sparse ids to avoid write conflict in t0Vec_. </p>
</dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle32DecayedAdagradParameterOptimizer6t0Vec_E">
<span id="paddle::DecayedAdagradParameterOptimizer::t0Vec___std::vector:int64_t:"></span><span class="target" id="paddleclasspaddle_1_1DecayedAdagradParameterOptimizer_1a1273cfe9d709fce66d1603018c8fddc7"></span>std::vector&lt;int64_t&gt; <code class="descname">t0Vec_</code><a class="headerlink" href="#_CPPv2N6paddle32DecayedAdagradParameterOptimizer6t0Vec_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
456 457 458 459
<dt id="_CPPv2N6paddle22AdamParameterOptimizerE">
<span id="paddle::AdamParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer"></span><em class="property">class </em><code class="descname">AdamParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><em>#include &lt;FirstOrderOptimizer.h&gt;</em><p>Adam Optimizer. Reference Paper: <a class="reference external" href="http://arxiv.org/abs/1412.6980">http://arxiv.org/abs/1412.6980</a> Algorithm 1 </p>
<p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
460 461 462
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
463 464
<dt id="_CPPv2N6paddle22AdamParameterOptimizer22AdamParameterOptimizerERK18OptimizationConfig">
<span id="paddle::AdamParameterOptimizer::AdamParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1aadf5341a443f954803f1017360c92701"></span><code class="descname">AdamParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer22AdamParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
465 466 467
<dd></dd></dl>

<dl class="function">
468 469 470
<dt id="_CPPv2N6paddle22AdamParameterOptimizer11finishBatchEv">
<span id="paddle::AdamParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1a9b5e0f460d6f1cb1c0a41c49861c4dbd"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
Y
Yu Yang 已提交
471 472
</dd></dl>

473 474 475 476
<dl class="function">
<dt id="_CPPv2N6paddle22AdamParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AdamParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1a64a586906f3f6a94a5cdf99cfcef2efc"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1AdamParameterOptimizer_1a9b5e0f460d6f1cb1c0a41c49861c4dbd"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdamParameterOptimizer_1a64a586906f3f6a94a5cdf99cfcef2efc"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
477 478
</dd></dl>

479
</div>
Y
Yu Yang 已提交
480
<div class="breathe-sectiondef container">
481 482 483 484
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle22AdamParameterOptimizer6beta1_E">
<span id="paddle::AdamParameterOptimizer::beta1___real"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1a4a167fccaa2d23d66b726219596dbf62"></span>real <code class="descname">beta1_</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer6beta1_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
485 486
<dd></dd></dl>

487 488 489
<dl class="member">
<dt id="_CPPv2N6paddle22AdamParameterOptimizer6beta2_E">
<span id="paddle::AdamParameterOptimizer::beta2___real"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1a389f09433b3f2e3c869483255315bf6e"></span>real <code class="descname">beta2_</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer6beta2_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
490 491
<dd></dd></dl>

492 493 494
<dl class="member">
<dt id="_CPPv2N6paddle22AdamParameterOptimizer8epsilon_E">
<span id="paddle::AdamParameterOptimizer::epsilon___real"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1ae5d29897eef4d4992fdb630805344fd0"></span>real <code class="descname">epsilon_</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer8epsilon_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
495 496
<dd></dd></dl>

497 498 499
<dl class="member">
<dt id="_CPPv2N6paddle22AdamParameterOptimizer5step_E">
<span id="paddle::AdamParameterOptimizer::step___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1a691a6775a91c6c618fd46732bdef8b45"></span>int64_t <code class="descname">step_</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer5step_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
500 501 502
<dd></dd></dl>

<dl class="member">
503 504
<dt id="_CPPv2N6paddle22AdamParameterOptimizer13learningRate_E">
<span id="paddle::AdamParameterOptimizer::learningRate___real"></span><span class="target" id="paddleclasspaddle_1_1AdamParameterOptimizer_1af424161c3270f360611a261c1e3286d7"></span>real <code class="descname">learningRate_</code><a class="headerlink" href="#_CPPv2N6paddle22AdamParameterOptimizer13learningRate_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
505 506 507 508 509 510
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
511 512 513 514
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizerE">
<span id="paddle::AdamaxParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer"></span><em class="property">class </em><code class="descname">AdamaxParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><em>#include &lt;FirstOrderOptimizer.h&gt;</em><p>AdaMax Optimizer. Reference Paper: <a class="reference external" href="http://arxiv.org/abs/1412.6980">http://arxiv.org/abs/1412.6980</a> Algorithm 2 </p>
<p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
515 516 517
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
518 519
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer24AdamaxParameterOptimizerERK18OptimizationConfig">
<span id="paddle::AdamaxParameterOptimizer::AdamaxParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1a45027c7231b86dd584bd02c4e3f2c571"></span><code class="descname">AdamaxParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer24AdamaxParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
520 521 522
<dd></dd></dl>

<dl class="function">
523 524
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer11finishBatchEv">
<span id="paddle::AdamaxParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1aaa4a8a18c7b3c76b079da382c30ba9a3"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
525 526 527 528
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
529 530 531
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AdamaxParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1a5034f51e1969041a51d9dc640ac42843"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1AdamaxParameterOptimizer_1aaa4a8a18c7b3c76b079da382c30ba9a3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdamaxParameterOptimizer_1a5034f51e1969041a51d9dc640ac42843"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
532 533 534 535 536 537
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
538 539
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer6beta1_E">
<span id="paddle::AdamaxParameterOptimizer::beta1___real"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1ad2032a40efd877f4fe13f905ad3cd1af"></span>real <code class="descname">beta1_</code><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer6beta1_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
540 541 542
<dd></dd></dl>

<dl class="member">
543 544
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer6beta2_E">
<span id="paddle::AdamaxParameterOptimizer::beta2___real"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1aec80fb78fc84b15d24ac8e63e4494eaa"></span>real <code class="descname">beta2_</code><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer6beta2_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
545 546 547
<dd></dd></dl>

<dl class="member">
548 549 550
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer5step_E">
<span id="paddle::AdamaxParameterOptimizer::step___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1aabb20367b60f23df2afd60104e2e8b85"></span>int64_t <code class="descname">step_</code><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer5step_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
Y
Yu Yang 已提交
551 552

<dl class="member">
553 554
<dt id="_CPPv2N6paddle24AdamaxParameterOptimizer13learningRate_E">
<span id="paddle::AdamaxParameterOptimizer::learningRate___real"></span><span class="target" id="paddleclasspaddle_1_1AdamaxParameterOptimizer_1a4b98ee1addc4bb9ae227e7d09ce83973"></span>real <code class="descname">learningRate_</code><a class="headerlink" href="#_CPPv2N6paddle24AdamaxParameterOptimizer13learningRate_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
555 556 557 558 559 560
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
561 562 563
<dt id="_CPPv2N6paddle12AddOptimizerE">
<span id="paddle::AddOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AddOptimizer"></span><em class="property">class </em><code class="descname">AddOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle12AddOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
564 565 566
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
567 568
<dt id="_CPPv2N6paddle12AddOptimizer12AddOptimizerERK18OptimizationConfig">
<span id="paddle::AddOptimizer::AddOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1AddOptimizer_1aa7de5bd440acf85bd84024c89c9e5cf0"></span><code class="descname">AddOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle12AddOptimizer12AddOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
569 570 571
<dd></dd></dl>

<dl class="function">
572 573
<dt id="_CPPv2N6paddle12AddOptimizer10startBatchE7int64_t">
<span id="paddle::AddOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1AddOptimizer_1a9aaaab2ed38c9590b8bc0d2e85cf8743"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle12AddOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
574 575 576 577
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
578 579 580
<dt id="_CPPv2N6paddle12AddOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AddOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AddOptimizer_1a64287dcefb5726a8a5e8f060c2fd4121"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle12AddOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1AddOptimizer_1a9aaaab2ed38c9590b8bc0d2e85cf8743"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AddOptimizer_1a64287dcefb5726a8a5e8f060c2fd4121"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
581 582
</dd></dl>

583 584 585 586 587 588 589 590 591 592 593 594 595 596
</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle14DummyOptimizerE">
<span id="paddle::DummyOptimizer"></span><span class="target" id="paddleclasspaddle_1_1DummyOptimizer"></span><em class="property">class </em><code class="descname">DummyOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle14DummyOptimizerE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle14DummyOptimizer14DummyOptimizerERK18OptimizationConfig">
<span id="paddle::DummyOptimizer::DummyOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1DummyOptimizer_1aa412e3e1ea8dfa4b49ed53a3a481c4d4"></span><code class="descname">DummyOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle14DummyOptimizer14DummyOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

Y
Yu Yang 已提交
597
<dl class="function">
598 599 600
<dt id="_CPPv2N6paddle14DummyOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::DummyOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1DummyOptimizer_1a5684ba7582d6615e448edd8ac8b4855f"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle14DummyOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1DummyOptimizer_1a5684ba7582d6615e448edd8ac8b4855f"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
601 602 603 604 605 606
</dd></dl>

</div>
</dd></dl>

<dl class="class">
607 608 609
<dt id="_CPPv2N6paddle29OptimizerWithGradientClippingE">
<span id="paddle::OptimizerWithGradientClipping"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping"></span><em class="property">class </em><code class="descname">OptimizerWithGradientClipping</code><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClippingE" title="Permalink to this definition"></a></dt>
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
610 611 612
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
613 614
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping29OptimizerWithGradientClippingERK18OptimizationConfigP18ParameterOptimizer">
<span id="paddle::OptimizerWithGradientClipping::OptimizerWithGradientClipping__OptimizationConfigCR.ParameterOptimizerP"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1a179499641cf8df23ac06bab25238ddf9"></span><code class="descname">OptimizerWithGradientClipping</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping29OptimizerWithGradientClippingERK18OptimizationConfigP18ParameterOptimizer" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
615 616 617
<dd></dd></dl>

<dl class="function">
618 619 620
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping4initE6size_tPK15ParameterConfig">
<span id="paddle::OptimizerWithGradientClipping::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1ae3532cb9e27980d21907abface19dcbc"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithGradientClipping_1a01a6071629082c59af350506ee658cee"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
621 622 623
</dd></dl>

<dl class="function">
624 625 626 627 628 629 630 631 632 633 634 635
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping9startPassEv">
<span id="paddle::OptimizerWithGradientClipping::startPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1aa960ef79c8ecade31afd24a353512f80"></span>void <code class="descname">startPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping9startPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping10finishPassEv">
<span id="paddle::OptimizerWithGradientClipping::finishPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1ad452c21d902f79dfd4901277dd4f006b"></span>void <code class="descname">finishPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping10finishPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping10startBatchE7int64_t">
<span id="paddle::OptimizerWithGradientClipping::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1a01a6071629082c59af350506ee658cee"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
636 637 638 639
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
640 641 642
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping11finishBatchEv">
<span id="paddle::OptimizerWithGradientClipping::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1a6148dfd60dd4df3a56ee7750b8dfee34"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
Y
Yu Yang 已提交
643 644 645
</dd></dl>

<dl class="function">
646 647
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::OptimizerWithGradientClipping::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1ac6e3ed587561bb6dfca96a303fe79c53"></span>TraverseCallback <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
648
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
665 666 667 668 669 670 671 672 673 674 675
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
676 677 678
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithGradientClipping::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1ad8bd6333c927524a9511db4fb80fdec6"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithGradientClipping_1a01a6071629082c59af350506ee658cee"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithGradientClipping_1a6148dfd60dd4df3a56ee7750b8dfee34"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithGradientClipping_1ad8bd6333c927524a9511db4fb80fdec6"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
679 680
</dd></dl>

681 682 683
<dl class="function">
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping10setNoDecayEv">
<span id="paddle::OptimizerWithGradientClipping::setNoDecay"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1a3bdfed694e864bbb4335031a90a1f2c5"></span>void <code class="descname">setNoDecay</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping10setNoDecayEv" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
684 685 686 687
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
688
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
Y
Yu Yang 已提交
689
<dl class="member">
690 691
<dt id="_CPPv2N6paddle29OptimizerWithGradientClipping10optimizer_E">
<span id="paddle::OptimizerWithGradientClipping::optimizer___std::unique_ptr:ParameterOptimizer:"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithGradientClipping_1a14d336f825d1a2628c1406d56e9b22fd"></span>std::unique_ptr&lt;<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>&gt; <code class="descname">optimizer_</code><a class="headerlink" href="#_CPPv2N6paddle29OptimizerWithGradientClipping10optimizer_E" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
692 693 694 695 696 697 698 699 700
<dd></dd></dl>

</div>
</dd></dl>

</dd></dl>

<dl class="type">
<dt id="_CPPv26paddle">
701
<span class="target" id="paddlenamespacepaddle"></span><em class="property">namespace </em><code class="descname">paddle</code><a class="headerlink" href="#_CPPv26paddle" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
702 703 704
<dd><dl class="class">
<dt id="_CPPv2N6paddle16AverageOptimizerE">
<span id="paddle::AverageOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer"></span><em class="property">class </em><code class="descname">AverageOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizerE" title="Permalink to this definition"></a></dt>
705 706
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
<p>Subclassed by <a class="reference internal" href="#paddleclasspaddle_1_1AverageSparseOptimizer"><span class="std std-ref">paddle::AverageSparseOptimizer</span></a></p>
Y
Yu Yang 已提交
707 708 709 710 711 712 713 714 715 716
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer16AverageOptimizerERK18OptimizationConfigP18ParameterOptimizerb">
<span id="paddle::AverageOptimizer::AverageOptimizer__OptimizationConfigCR.ParameterOptimizerP.b"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1ae90e86daccea8b8ef7ad407e14a55150"></span><code class="descname">AverageOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, bool <em>useParameterApply</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer16AverageOptimizerERK18OptimizationConfigP18ParameterOptimizerb" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::AverageOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a8b378390826e64e540672216c3d1237e"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
717
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1acb53cfbb4a2403f005172a05bc63ad1e"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer9startPassEv">
<span id="paddle::AverageOptimizer::startPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1ac71f80803711cb8038d33dfebf1824a8"></span>void <code class="descname">startPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer9startPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer10finishPassEv">
<span id="paddle::AverageOptimizer::finishPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1af62b262e52336575f76928361fd85449"></span>void <code class="descname">finishPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer10finishPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer10startBatchE7int64_t">
<span id="paddle::AverageOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1acb53cfbb4a2403f005172a05bc63ad1e"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer11finishBatchEv">
<span id="paddle::AverageOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a63c94b0bdcbd9e02e3c4b4b02a77bcd8"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AverageOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a1e4fd183d5aec84f62825a479b0998b2"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
745
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1acb53cfbb4a2403f005172a05bc63ad1e"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1a63c94b0bdcbd9e02e3c4b4b02a77bcd8"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1a1e4fd183d5aec84f62825a479b0998b2"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
746 747 748 749 750 751
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::AverageOptimizer::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a8666fab05830d29dfacc98e9d5dfe63d"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
768 769 770 771 772 773 774 775 776 777 778 779 780
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer16startCatchUpWithEv">
<span id="paddle::AverageOptimizer::startCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a25fb61164897b4b45545e7e1321984b8"></span>TraverseCallback <code class="descname">startCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer16startCatchUpWithEv" title="Permalink to this definition"></a></dt>
781 782 783 784 785 786 787 788 789 790 791 792
<dd><p>following hooks catch up with current time for sparse update, In the beginning, call <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1a25fb61164897b4b45545e7e1321984b8"><span class="std std-ref">startCatchUpWith()</span></a> and check return. In the end, call finishCatchUpWith() to finish state. callback do the actual works, can call many times for sparse data. e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">startCatchUpWith</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
  <span class="o">//</span> <span class="n">finish</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">main</span> <span class="n">thread</span>
  <span class="n">finishCatchUpWith</span><span class="p">();</span>
<span class="p">}</span>
Y
Yu Yang 已提交
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need catch up with, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer17finishCatchUpWithEv">
<span id="paddle::AverageOptimizer::finishCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1abde666e1eced5f46d60035906f97c701"></span>void <code class="descname">finishCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer17finishCatchUpWithEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer5applyEv">
<span id="paddle::AverageOptimizer::apply"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1ae2e19fa960d02ef14b082e9022b08a45"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">apply</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer5applyEv" title="Permalink to this definition"></a></dt>
<dd><p>following two hooks used by averager, apply to final parameter value (PARAMETER_VALUE or PARAMETER_APPLY).</p>
<p>restore() will restore orginal value if it apply to PARAMETER_VALUE. Caller must ensure it&#8217;s catched up with current time before apply.</p>
813
<p>Use returned callback same way as callback returned by <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1afec182e2d4c2bac9b2a9aa5cc3b1156e"><span class="std std-ref">ParameterOptimizer::needSpecialTraversal()</span></a> </p>
Y
Yu Yang 已提交
814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer7restoreEv">
<span id="paddle::AverageOptimizer::restore"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a406a7648c9fb4f0ef60bd2c4faba41f7"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">restore</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer7restoreEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer10setNoDecayEv">
<span id="paddle::AverageOptimizer::setNoDecay"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1ac7cb59fd86916773a3d0216cda6c0cd1"></span>void <code class="descname">setNoDecay</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer10setNoDecayEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Static Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer6createERK18OptimizationConfigP18ParameterOptimizerbb">
<span id="paddle::AverageOptimizer::create__OptimizationConfigCR.ParameterOptimizerP.b.b"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1aceee2008aacd6c93239e07c8b4bf8505"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<code class="descname">create</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, bool <em>isParameterSparse</em> = false, bool <em>useParameterApply</em> = false<span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer6createERK18OptimizationConfigP18ParameterOptimizerbb" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer24updateAverageWindowLimitEv">
<span id="paddle::AverageOptimizer::updateAverageWindowLimit"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a29306f944c2dad0f8750d33d73e92416"></span>void <code class="descname">updateAverageWindowLimit</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer24updateAverageWindowLimitEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle16AverageOptimizer22isAverageWindowTooLongEv">
<span id="paddle::AverageOptimizer::isAverageWindowTooLong"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a7e3cdf43733da5efc1ebe130fc3dd1e6"></span>bool <code class="descname">isAverageWindowTooLong</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer22isAverageWindowTooLongEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer10optimizer_E">
<span id="paddle::AverageOptimizer::optimizer___std::unique_ptr:ParameterOptimizer:"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1af8853223a3ee5597b5d14215e55f6186"></span>std::unique_ptr&lt;<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>&gt; <code class="descname">optimizer_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer10optimizer_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer9useApply_E">
<span id="paddle::AverageOptimizer::useApply___b"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a38835c3361fe07284df89742c5167832"></span>bool <code class="descname">useApply_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer9useApply_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer11numUpdates_E">
<span id="paddle::AverageOptimizer::numUpdates___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1aca15c641b1688eb21a49b9d91db46c79"></span>int64_t <code class="descname">numUpdates_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer11numUpdates_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer15prevNumUpdates_E">
<span id="paddle::AverageOptimizer::prevNumUpdates___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a7601c59d6484fe240bbf4dfaf316da75"></span>int64_t <code class="descname">prevNumUpdates_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer15prevNumUpdates_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer15numAccumulates_E">
<span id="paddle::AverageOptimizer::numAccumulates___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a5688eaf3cc109bc805105cc8b77bf372"></span>int64_t <code class="descname">numAccumulates_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer15numAccumulates_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer18oldNumAccumulates_E">
<span id="paddle::AverageOptimizer::oldNumAccumulates___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1a4c88162b14235d647478763988690bf4"></span>int64_t <code class="descname">oldNumAccumulates_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer18oldNumAccumulates_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer17minAverageWindow_E">
<span id="paddle::AverageOptimizer::minAverageWindow___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1af7c0a263135523d8380b638ebb9950c1"></span>int64_t <code class="descname">minAverageWindow_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer17minAverageWindow_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer17maxAverageWindow_E">
<span id="paddle::AverageOptimizer::maxAverageWindow___int64_t"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1ac2401aa4aed47150c349daf87da20970"></span>int64_t <code class="descname">maxAverageWindow_</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer17maxAverageWindow_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Static Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle16AverageOptimizer18kMaxNumAccumulatesE">
<span id="paddle::AverageOptimizer::kMaxNumAccumulates__int64_tC"></span><span class="target" id="paddleclasspaddle_1_1AverageOptimizer_1aa5d312e78e8357690766e489d346f93d"></span><em class="property">const</em> int64_t <code class="descname">kMaxNumAccumulates</code><a class="headerlink" href="#_CPPv2N6paddle16AverageOptimizer18kMaxNumAccumulatesE" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle22AverageSparseOptimizerE">
<span id="paddle::AverageSparseOptimizer"></span><span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer"></span><em class="property">class </em><code class="descname">AverageSparseOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizerE" title="Permalink to this definition"></a></dt>
904
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer"><span class="std std-ref">paddle::AverageOptimizer</span></a></p>
Y
Yu Yang 已提交
905 906 907 908 909 910 911 912 913 914
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer22AverageSparseOptimizerERK18OptimizationConfigP18ParameterOptimizerb">
<span id="paddle::AverageSparseOptimizer::AverageSparseOptimizer__OptimizationConfigCR.ParameterOptimizerP.b"></span><span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a26ce359f997f788a5063b9dde60a4989"></span><code class="descname">AverageSparseOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, bool <em>useParameterApply</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer22AverageSparseOptimizerERK18OptimizationConfigP18ParameterOptimizerb" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::AverageSparseOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a7240ea3fd2b1ddb175b422445fdddb85"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
915
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1acb53cfbb4a2403f005172a05bc63ad1e"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
916 917 918 919 920 921 922 923 924 925 926
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer11finishBatchEv">
<span id="paddle::AverageSparseOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a36f150f4b0866bfe68375bb2f9f96b93"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AverageSparseOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1ac697800ddab2000986ceb08749299e0e"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
927
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer_1acb53cfbb4a2403f005172a05bc63ad1e"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1AverageSparseOptimizer_1a36f150f4b0866bfe68375bb2f9f96b93"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AverageSparseOptimizer_1ac697800ddab2000986ceb08749299e0e"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
928 929 930 931 932 933 934 935 936 937
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::AverageSparseOptimizer::catchUpWith__VectorPtrCA.ParameterConfigCR.s"></span><span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1aac60c1520957012ec5d6e5cd8f1bc491"></span>void <code class="descname">catchUpWith</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>paraConfig</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer16startCatchUpWithEv">
<span id="paddle::AverageSparseOptimizer::startCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1adc12f1012590d742faed05ef291521f6"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">startCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer16startCatchUpWithEv" title="Permalink to this definition"></a></dt>
938 939 940 941 942 943 944 945 946 947 948 949
<dd><p>following hooks catch up with current time for sparse update, In the beginning, call <a class="reference internal" href="#paddleclasspaddle_1_1AverageSparseOptimizer_1adc12f1012590d742faed05ef291521f6"><span class="std std-ref">startCatchUpWith()</span></a> and check return. In the end, call finishCatchUpWith() to finish state. callback do the actual works, can call many times for sparse data. e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">startCatchUpWith</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
  <span class="o">//</span> <span class="n">finish</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">main</span> <span class="n">thread</span>
  <span class="n">finishCatchUpWith</span><span class="p">();</span>
<span class="p">}</span>
Y
Yu Yang 已提交
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need catch up with, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer17finishCatchUpWithEv">
<span id="paddle::AverageSparseOptimizer::finishCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a65e718d0cd4950f11a0fe4ba248a263b"></span>void <code class="descname">finishCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer17finishCatchUpWithEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer6timer_E">
<span id="paddle::AverageSparseOptimizer::timer___i"></span><span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a446bf9258727421d69554b9f77605730"></span>int <code class="descname">timer_</code><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer6timer_E" title="Permalink to this definition"></a></dt>
<dd><p>counting batches, clear after catch up with t(timer_) is current time, t0(t0Vec_) are last occur time of i rows. if one block is update by multi threads, caller should hash sparse ids to avoid write conflict in t0Vec_. </p>
</dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle22AverageSparseOptimizer6t0Vec_E">
<span id="paddle::AverageSparseOptimizer::t0Vec___std::vector:int32_t:"></span><span class="target" id="paddleclasspaddle_1_1AverageSparseOptimizer_1a37866ccdbac93f3e2854a3e5446b6af5"></span>std::vector&lt;int32_t&gt; <code class="descname">t0Vec_</code><a class="headerlink" href="#_CPPv2N6paddle22AverageSparseOptimizer6t0Vec_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
</dd></dl>

</dd></dl>

<dl class="type">
985 986
<dt>
<span class="target" id="paddlenamespacepaddle"></span><em class="property">namespace </em><code class="descname">paddle</code></dt>
Y
Yu Yang 已提交
987 988 989 990 991
<dd><dl class="class">
<dt id="_CPPv2N6paddle18ParameterOptimizerE">
<span id="paddle::ParameterOptimizer"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer"></span><em class="property">class </em><code class="descname">ParameterOptimizer</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizerE" title="Permalink to this definition"></a></dt>
<dd><em>#include &lt;ParameterOptimizer.h&gt;</em><p>Some member functions are set to const for two reasons:</p>
<p><ol class="arabic simple">
992 993
<li>For sparse update thread safe: <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1ac2f022ac5222500fda5c9d1027bb8a06"><span class="std std-ref">update()</span></a>, traverse callback(const this) may be called many times, each time one row, and these function can be called parallelly by multi worker, to speed up large block.</li>
<li>For predicate functions, <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1afec182e2d4c2bac9b2a9aa5cc3b1156e"><span class="std std-ref">needSpecialTraversal()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1ac247dc85e634d427f578bbcc856b9887"><span class="std std-ref">startCatchUpWith()</span></a> may be called many times, should be no state change between calls. </li>
Y
Yu Yang 已提交
994 995
</ol>
</p>
996
<p>Subclassed by <a class="reference internal" href="#paddleclasspaddle_1_1AdaDeltaParameterOptimizer"><span class="std std-ref">paddle::AdaDeltaParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdagradParameterOptimizer"><span class="std std-ref">paddle::AdagradParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdamaxParameterOptimizer"><span class="std std-ref">paddle::AdamaxParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AdamParameterOptimizer"><span class="std std-ref">paddle::AdamParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AddOptimizer"><span class="std std-ref">paddle::AddOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1AverageOptimizer"><span class="std std-ref">paddle::AverageOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1DecayedAdagradParameterOptimizer"><span class="std std-ref">paddle::DecayedAdagradParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1DummyOptimizer"><span class="std std-ref">paddle::DummyOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithGradientClipping"><span class="std std-ref">paddle::OptimizerWithGradientClipping</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer"><span class="std std-ref">paddle::OptimizerWithRegularizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1RMSPropParameterOptimizer"><span class="std std-ref">paddle::RMSPropParameterOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1SgdOptimizer"><span class="std std-ref">paddle::SgdOptimizer</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1SparseMomentumParameterOptimizer"><span class="std std-ref">paddle::SparseMomentumParameterOptimizer</span></a></p>
Y
Yu Yang 已提交
997 998 999 1000
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Types</p>
<dl class="type">
<dt id="_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE">
1001
<span id="paddle::ParameterOptimizer::TraverseCallback"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1af35823117cc054b5a3066cf4cd09c0fb"></span><em class="property">typedef </em>std::function&lt;void<span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> vecs[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;config, size_t sparseId<span class="sig-paren">)</span>&gt; <code class="descname">TraverseCallback</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer18ParameterOptimizerERK18OptimizationConfig">
<span id="paddle::ParameterOptimizer::ParameterOptimizer__OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a89dceaca58771a204f53867f57e27bf7"></span><code class="descname">ParameterOptimizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer18ParameterOptimizerERK18OptimizationConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer16calcLearningRateE7int64_t7int64_t">
<span id="paddle::ParameterOptimizer::calcLearningRate__int64_t.int64_t"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a0a1ed4235c4e1bcb9c79e34b558c41c0"></span>real <code class="descname">calcLearningRate</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em>, int64_t <em>pass</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer16calcLearningRateE7int64_t7int64_t" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizerD0Ev">
<span id="paddle::ParameterOptimizer::~ParameterOptimizer"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1aba0d599b45c29ad1d97024db217fbeff"></span><code class="descname">~ParameterOptimizer</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizerD0Ev" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer4initE6size_tPK15ParameterConfig">
<span id="paddle::ParameterOptimizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ac6752089a478b3f0093749b5cac70fba"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
1025
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer9startPassEv">
<span id="paddle::ParameterOptimizer::startPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a5e97ff80c81904cde0ff6369470e512f"></span>void <code class="descname">startPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer9startPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer10finishPassEv">
<span id="paddle::ParameterOptimizer::finishPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a3dc2fe520f79ea181c4166b04efbfb55"></span>void <code class="descname">finishPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer10finishPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer10startBatchE7int64_t">
<span id="paddle::ParameterOptimizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::ParameterOptimizer::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1afec182e2d4c2bac9b2a9aa5cc3b1156e"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer11finishBatchEv">
<span id="paddle::ParameterOptimizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
1082 1083
<span id="paddle::ParameterOptimizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ac2f022ac5222500fda5c9d1027bb8a06"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em> = -1LU<span class="sig-paren">)</span> const = 0<a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1aa524be2e130730a4ea351b3aea2d816f"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1a260329cf2cd4259384db03fa5c1ec3f3"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1ac2f022ac5222500fda5c9d1027bb8a06"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
1084 1085 1086 1087 1088
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer16startCatchUpWithEv">
<span id="paddle::ParameterOptimizer::startCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ac247dc85e634d427f578bbcc856b9887"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">startCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer16startCatchUpWithEv" title="Permalink to this definition"></a></dt>
1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100
<dd><p>following hooks catch up with current time for sparse update, In the beginning, call <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1ac247dc85e634d427f578bbcc856b9887"><span class="std std-ref">startCatchUpWith()</span></a> and check return. In the end, call finishCatchUpWith() to finish state. callback do the actual works, can call many times for sparse data. e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">startCatchUpWith</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
  <span class="o">//</span> <span class="n">finish</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">main</span> <span class="n">thread</span>
  <span class="n">finishCatchUpWith</span><span class="p">();</span>
<span class="p">}</span>
Y
Yu Yang 已提交
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need catch up with, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer17finishCatchUpWithEv">
<span id="paddle::ParameterOptimizer::finishCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a6f7165a3982989cba9e5d225e5f0a68d"></span>void <code class="descname">finishCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer17finishCatchUpWithEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer5applyEv">
<span id="paddle::ParameterOptimizer::apply"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1aca2f346a8982d45ab528fdac40db05b3"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">apply</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer5applyEv" title="Permalink to this definition"></a></dt>
<dd><p>following two hooks used by averager, apply to final parameter value (PARAMETER_VALUE or PARAMETER_APPLY).</p>
<p>restore() will restore orginal value if it apply to PARAMETER_VALUE. Caller must ensure it&#8217;s catched up with current time before apply.</p>
1121
<p>Use returned callback same way as callback returned by <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer_1afec182e2d4c2bac9b2a9aa5cc3b1156e"><span class="std std-ref">ParameterOptimizer::needSpecialTraversal()</span></a> </p>
Y
Yu Yang 已提交
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer7restoreEv">
<span id="paddle::ParameterOptimizer::restore"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a0ce7a3d0de9d024e81cec54dad161090"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">restore</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer7restoreEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer17getParameterTypesEv">
<span id="paddle::ParameterOptimizer::getParameterTypes"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a5a33aa28130835447d58e567f71f21ec"></span><em class="property">const</em> std::vector&lt;ParameterType&gt; &amp;<code class="descname">getParameterTypes</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer17getParameterTypesEv" title="Permalink to this definition"></a></dt>
<dd><p>return the parameter types used by this updater </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer16addParameterTypeE13ParameterType">
<span id="paddle::ParameterOptimizer::addParameterType__ParameterType"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a6acbbd875936710c42ce8f2ec7957c04"></span>void <code class="descname">addParameterType</code><span class="sig-paren">(</span>ParameterType <em>type</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer16addParameterTypeE13ParameterType" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer15getLearningRateEv">
<span id="paddle::ParameterOptimizer::getLearningRate"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a169537fae382ca494659acbd72389adf"></span>real <code class="descname">getLearningRate</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer15getLearningRateEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer10setNoDecayEv">
<span id="paddle::ParameterOptimizer::setNoDecay"></span>virtual <span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1acd224664f841eb0c3a155f86ef111256"></span>void <code class="descname">setNoDecay</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer10setNoDecayEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Static Functions</p>
<dl class="function">
<dt id="_CPPv2N18ParameterOptimizer6createERK18OptimizationConfigb">
1155
<span id="ParameterOptimizer::create__OptimizationConfigCR.b"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a8f083c03a2d8b7ab22fe5fc57051cf0e"></span><a class="reference internal" href="../../api/api.html#_CPPv218ParameterOptimizer" title="ParameterOptimizer">ParameterOptimizer</a> *<code class="descname">create</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, bool <em>inPserver</em> = false<span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N18ParameterOptimizer6createERK18OptimizationConfigb" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
1156 1157 1158 1159 1160 1161 1162
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Types</p>
<dl class="type">
<dt id="_CPPv2N6paddle18ParameterOptimizer19TraverseCallbackVecE">
1163
<span id="paddle::ParameterOptimizer::TraverseCallbackVec"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ad8abe87d8f9781a92f57dd2fe50c5f02"></span><em class="property">typedef </em>std::vector&lt;<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a>&gt; <code class="descname">TraverseCallbackVec</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer19TraverseCallbackVecE" title="Permalink to this definition"></a></dt>
Y
Yu Yang 已提交
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer11applyDecay_E">
<span id="paddle::ParameterOptimizer::applyDecay___b"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ae58ade02db465d54496384750c2b1a60"></span>bool <code class="descname">applyDecay_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer11applyDecay_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer10optConfig_E">
<span id="paddle::ParameterOptimizer::optConfig___OptimizationConfigCR"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1aeffbffd43e11c430f7eebda84043eef4"></span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<code class="descname">optConfig_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer10optConfig_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer15parameterTypes_E">
<span id="paddle::ParameterOptimizer::parameterTypes___std::vector:ParameterType:"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a44462cd2d98006a2a0ac6647cdd7e78c"></span>std::vector&lt;ParameterType&gt; <code class="descname">parameterTypes_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer15parameterTypes_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer13learningRate_E">
<span id="paddle::ParameterOptimizer::learningRate___real"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ad6aaa634ee1003524a7d7b0078d3c271"></span>real <code class="descname">learningRate_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer13learningRate_E" title="Permalink to this definition"></a></dt>
<dd><p>global learning rate, init value is opt_config.learning_rate, sparse regularizer get this value per batch, after StartBatch() called so, if lr change in StartBatch, please assign to learningRate_ </p>
</dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer22learningRateScheduler_E">
<span id="paddle::ParameterOptimizer::learningRateScheduler___std::unique_ptr:LearningRateScheduler:"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a50ba133cc28f3309990d57b49e7a43b3"></span>std::unique_ptr&lt;LearningRateScheduler&gt; <code class="descname">learningRateScheduler_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer22learningRateScheduler_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer5pass_E">
<span id="paddle::ParameterOptimizer::pass___int64_t"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1afdc0d5eb328aa6480097e5e3ca6387ae"></span>int64_t <code class="descname">pass_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer5pass_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle18ParameterOptimizer10firstTime_E">
<span id="paddle::ParameterOptimizer::firstTime___b"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1a7841b6e8fa2c664ffb4c0faf8908a96d"></span>bool <code class="descname">firstTime_</code><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer10firstTime_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Static Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle18ParameterOptimizer16composeCallbacksERK19TraverseCallbackVec">
<span id="paddle::ParameterOptimizer::composeCallbacks__TraverseCallbackVecCR"></span><span class="target" id="paddleclasspaddle_1_1ParameterOptimizer_1ae260571ee7b0d80946d334a3d51f13a3"></span><em class="property">static</em> <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">composeCallbacks</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer19TraverseCallbackVecE" title="paddle::ParameterOptimizer::TraverseCallbackVec">TraverseCallbackVec</a> &amp;<em>callbacks</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle18ParameterOptimizer16composeCallbacksERK19TraverseCallbackVec" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
</dd></dl>

</dd></dl>

<dl class="type">
1219 1220
<dt>
<span class="target" id="paddlenamespacepaddle"></span><em class="property">namespace </em><code class="descname">paddle</code></dt>
Y
Yu Yang 已提交
1221 1222 1223
<dd><dl class="class">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizerE">
<span id="paddle::OptimizerWithRegularizer"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer"></span><em class="property">class </em><code class="descname">OptimizerWithRegularizer</code><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizerE" title="Permalink to this definition"></a></dt>
1224 1225
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1ParameterOptimizer"><span class="std std-ref">paddle::ParameterOptimizer</span></a></p>
<p>Subclassed by <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches"><span class="std std-ref">paddle::OptimizerWithRegularizerEveryNumBatches</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerSparse"><span class="std std-ref">paddle::OptimizerWithRegularizerSparse</span></a></p>
Y
Yu Yang 已提交
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer24OptimizerWithRegularizerERK18OptimizationConfigP18ParameterOptimizerP11Regularizer">
<span id="paddle::OptimizerWithRegularizer::OptimizerWithRegularizer__OptimizationConfigCR.ParameterOptimizerP.RegularizerP"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1ab7944195971761e779fd4ae01580a6ab"></span><code class="descname">OptimizerWithRegularizer</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, <a class="reference internal" href="../parameter/parameter.html#_CPPv2N6paddle11RegularizerE" title="paddle::Regularizer">Regularizer</a> *<em>regularizer</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer24OptimizerWithRegularizerERK18OptimizationConfigP18ParameterOptimizerP11Regularizer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer4initE6size_tPK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizer::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1ade284070a64ded07254727b4122f77d7"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
1236
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer9startPassEv">
<span id="paddle::OptimizerWithRegularizer::startPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1ab9bf54c65ec830ffa881b576caa81ba2"></span>void <code class="descname">startPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer9startPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer10finishPassEv">
<span id="paddle::OptimizerWithRegularizer::finishPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1adb294006f7239fe7ac679ddae143d40d"></span>void <code class="descname">finishPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer10finishPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer10startBatchE7int64_t">
<span id="paddle::OptimizerWithRegularizer::startBatch__int64_t"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"></span>void <code class="descname">startBatch</code><span class="sig-paren">(</span>int64_t <em>numSamplesProcessed</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer10startBatchE7int64_t" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer before forward() of a batch. </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer11finishBatchEv">
<span id="paddle::OptimizerWithRegularizer::finishBatch"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1a07b935a3f25a1b5130dc1ec9aa33179d"></span>void <code class="descname">finishBatch</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer11finishBatchEv" title="Permalink to this definition"></a></dt>
<dd><p>called by Trainer after backward() of a batch </p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizer::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1aa882a31e2086fa364c3370032a634b7b"></span>TraverseCallback <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithRegularizer::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1ab22cb81e799739c7c02896e7e75aae8c"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
1294
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a07b935a3f25a1b5130dc1ec9aa33179d"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1ab22cb81e799739c7c02896e7e75aae8c"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329
</dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Static Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer6createERK18OptimizationConfigRK15ParameterConfigbb">
<span id="paddle::OptimizerWithRegularizer::create__OptimizationConfigCR.ParameterConfigCR.b.b"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1acca8297b580d9cdf1c4f2648ccd638a5"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<code class="descname">create</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>paraConfig</em>, bool <em>isParameterSparse</em>, bool <em>inPserver</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer6createERK18OptimizationConfigRK15ParameterConfigbb" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer10optimizer_E">
<span id="paddle::OptimizerWithRegularizer::optimizer___std::unique_ptr:ParameterOptimizer:"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1ab0bcf2325b88ff638adcf86e46646446"></span>std::unique_ptr&lt;<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>&gt; <code class="descname">optimizer_</code><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer10optimizer_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer12regularizer_E">
<span id="paddle::OptimizerWithRegularizer::regularizer___RegularizerP"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1a9d53d48a07bf36b0da32f8a7e9d2fbed"></span><a class="reference internal" href="../parameter/parameter.html#_CPPv2N6paddle11RegularizerE" title="paddle::Regularizer">Regularizer</a> *<code class="descname">regularizer_</code><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer12regularizer_E" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="member">
<dt id="_CPPv2N6paddle24OptimizerWithRegularizer6timer_E">
<span id="paddle::OptimizerWithRegularizer::timer___i"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizer_1a39dfa8cfd149e937eaec286078448b0b"></span>int <code class="descname">timer_</code><a class="headerlink" href="#_CPPv2N6paddle24OptimizerWithRegularizer6timer_E" title="Permalink to this definition"></a></dt>
<dd><p>counting batches, clear after catch up with t(timer_) is current time, t0(t0Vec_) are last occur time of i rows. if one block is update by multi threads, caller should hash sparse ids to avoid write conflict in t0Vec_. </p>
</dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatchesE">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches"></span><em class="property">class </em><code class="descname">OptimizerWithRegularizerEveryNumBatches</code><a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatchesE" title="Permalink to this definition"></a></dt>
1330
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer"><span class="std std-ref">paddle::OptimizerWithRegularizer</span></a></p>
Y
Yu Yang 已提交
1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches39OptimizerWithRegularizerEveryNumBatchesERK18OptimizationConfigP18ParameterOptimizerP11Regularizer">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::OptimizerWithRegularizerEveryNumBatches__OptimizationConfigCR.ParameterOptimizerP.RegularizerP"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a6fa43f7f6739d3df416bc6de2d223af4"></span><code class="descname">OptimizerWithRegularizerEveryNumBatches</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, <a class="reference internal" href="../parameter/parameter.html#_CPPv2N6paddle11RegularizerE" title="paddle::Regularizer">Regularizer</a> *<em>regularizer</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches39OptimizerWithRegularizerEveryNumBatchesERK18OptimizationConfigP18ParameterOptimizerP11Regularizer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches9startPassEv">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::startPass"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a19e7f0b866ce42494bbb2eebe7499db4"></span>void <code class="descname">startPass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches9startPassEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a79cecbf803dd0f10b1903e6cae97396b"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
1346
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a07b935a3f25a1b5130dc1ec9aa33179d"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a79cecbf803dd0f10b1903e6cae97396b"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
1347 1348 1349 1350 1351 1352
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches20needSpecialTraversalERK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::needSpecialTraversal__ParameterConfigCR"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a92cab2d8f80bc2a502172bccb2305fd5"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">needSpecialTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches20needSpecialTraversalERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd><p>following hooks useful for sparse update, because the traversal in block costs. called by Trainer after update and before finishBatch e.g. Trainer call like this:</p>
1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">startBatch</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
  <span class="n">update</span><span class="p">(</span><span class="n">blockVec</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
  <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">update</span><span class="p">(</span><span class="n">rowVec</span><span class="p">)}</span>
<span class="p">}</span>
<span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">needSpecialTraversal</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">traverse</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">all_rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
<span class="p">}</span>
<span class="n">finishBatch</span><span class="p">();</span>
Y
Yu Yang 已提交
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need traverse, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches11doTraversalEA_K9VectorPtrRK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::doTraversal__VectorPtrCA.ParameterConfigCR"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1aaa4e0626e0073a94a4a9576816767352"></span>void <code class="descname">doTraversal</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches11doTraversalEA_K9VectorPtrRK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::catchUpWith__VectorPtrCA.ParameterConfigCR.s"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a6857d1662f2b36074a3a5d764a699d94"></span>void <code class="descname">catchUpWith</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches16startCatchUpWithEv">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::startCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a80e08f38770ec53389c633d8fa6b8f42"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">startCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches16startCatchUpWithEv" title="Permalink to this definition"></a></dt>
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403
<dd><p>following hooks catch up with current time for sparse update, In the beginning, call <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a80e08f38770ec53389c633d8fa6b8f42"><span class="std std-ref">startCatchUpWith()</span></a> and check return. In the end, call finishCatchUpWith() to finish state. callback do the actual works, can call many times for sparse data. e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">startCatchUpWith</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
  <span class="o">//</span> <span class="n">finish</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">main</span> <span class="n">thread</span>
  <span class="n">finishCatchUpWith</span><span class="p">();</span>
<span class="p">}</span>
Y
Yu Yang 已提交
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need catch up with, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches17finishCatchUpWithEv">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::finishCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a87b3cec2d9e13051ba2ddbf7039b3931"></span>void <code class="descname">finishCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches17finishCatchUpWithEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches21isRegularizationBatchERK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::isRegularizationBatch__ParameterConfigCR"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1afe0f82ab916adebfbaa97470614e7478"></span>bool <code class="descname">isRegularizationBatch</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches21isRegularizationBatchERK15ParameterConfig" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches10baseTimer_E">
<span id="paddle::OptimizerWithRegularizerEveryNumBatches::baseTimer___i"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerEveryNumBatches_1a327aabc975f7c5733c10d23626043515"></span>int <code class="descname">baseTimer_</code><a class="headerlink" href="#_CPPv2N6paddle39OptimizerWithRegularizerEveryNumBatches10baseTimer_E" title="Permalink to this definition"></a></dt>
<dd><p>recored the timer_ value while catchUpWith called. </p>
</dd></dl>

</div>
</dd></dl>

<dl class="class">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparseE">
<span id="paddle::OptimizerWithRegularizerSparse"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse"></span><em class="property">class </em><code class="descname">OptimizerWithRegularizerSparse</code><a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparseE" title="Permalink to this definition"></a></dt>
1442
<dd><p>Inherits from <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer"><span class="std std-ref">paddle::OptimizerWithRegularizer</span></a></p>
Y
Yu Yang 已提交
1443 1444 1445 1446 1447 1448 1449 1450 1451 1452
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Public Functions</p>
<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse30OptimizerWithRegularizerSparseERK18OptimizationConfigP18ParameterOptimizerP11Regularizer">
<span id="paddle::OptimizerWithRegularizerSparse::OptimizerWithRegularizerSparse__OptimizationConfigCR.ParameterOptimizerP.RegularizerP"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a42b03b4ab154747419af177d40211c32"></span><code class="descname">OptimizerWithRegularizerSparse</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv218OptimizationConfig" title="OptimizationConfig">OptimizationConfig</a> &amp;<em>optConfig</em>, <a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a> *<em>optimizer</em>, <a class="reference internal" href="../parameter/parameter.html#_CPPv2N6paddle11RegularizerE" title="paddle::Regularizer">Regularizer</a> *<em>regularizer</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse30OptimizerWithRegularizerSparseERK18OptimizationConfigP18ParameterOptimizerP11Regularizer" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse4initE6size_tPK15ParameterConfig">
<span id="paddle::OptimizerWithRegularizerSparse::init__s.ParameterConfigCP"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1ad6110975e0cf8411280523f463021662"></span>void <code class="descname">init</code><span class="sig-paren">(</span>size_t <em>numRows</em>, <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> *<em>config</em><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse4initE6size_tPK15ParameterConfig" title="Permalink to this definition"></a></dt>
1453
<dd><p>For sparse update, optimizer can maintain numRows of timer(t0). Some sparse optimizer depends on parameter config in functions such as <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"><span class="std std-ref">startBatch()</span></a>. Optimizer can get it here. But notice that, not all callers can pass config here, so the optimizer should check config passed in is not null ptr. </p>
Y
Yu Yang 已提交
1454 1455 1456 1457 1458
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse6updateEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithRegularizerSparse::update__VectorPtrCA.ParameterConfigCR.s"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a50bb9332691195885d4fa8c818fed621"></span>void <code class="descname">update</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse6updateEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
1459
<dd><p>between <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a0f437aca89ccb0879f92a5c5ef437652"><span class="std std-ref">startBatch()</span></a> and <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizer_1a07b935a3f25a1b5130dc1ec9aa33179d"><span class="std std-ref">finishBatch()</span></a>, <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a50bb9332691195885d4fa8c818fed621"><span class="std std-ref">update()</span></a> will be called by the trainer multiple times, each time for updating one <a class="reference internal" href="../parameter/parameter.html#paddleclasspaddle_1_1Parameter"><span class="std std-ref">Parameter</span></a> with its gradient in PARAMETER_GRADIENT. sparseId is row id, when sparseId set, update is sparse, each time one row. </p>
Y
Yu Yang 已提交
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t">
<span id="paddle::OptimizerWithRegularizerSparse::catchUpWith__VectorPtrCA.ParameterConfigCR.s"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a4df8963a794500cbe49a6f430e784d71"></span>void <code class="descname">catchUpWith</code><span class="sig-paren">(</span><em class="property">const</em> <a class="reference internal" href="../../math/matrix/matrix.html#_CPPv2N6paddle9VectorPtrE" title="paddle::VectorPtr">VectorPtr</a> <em>vecs</em>[], <em class="property">const</em> <a class="reference internal" href="../../api/api.html#_CPPv215ParameterConfig" title="ParameterConfig">ParameterConfig</a> &amp;<em>config</em>, size_t <em>sparseId</em><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse11catchUpWithEA_K9VectorPtrRK15ParameterConfig6size_t" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse16startCatchUpWithEv">
<span id="paddle::OptimizerWithRegularizerSparse::startCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a1d698def06a3a1c1afb8c3008e460443"></span><a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizerE" title="paddle::ParameterOptimizer">ParameterOptimizer</a>::<a class="reference internal" href="#_CPPv2N6paddle18ParameterOptimizer16TraverseCallbackE" title="paddle::ParameterOptimizer::TraverseCallback">TraverseCallback</a> <code class="descname">startCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span> const<a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse16startCatchUpWithEv" title="Permalink to this definition"></a></dt>
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481
<dd><p>following hooks catch up with current time for sparse update, In the beginning, call <a class="reference internal" href="#paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a1d698def06a3a1c1afb8c3008e460443"><span class="std std-ref">startCatchUpWith()</span></a> and check return. In the end, call finishCatchUpWith() to finish state. callback do the actual works, can call many times for sparse data. e.g. Trainer call like this:</p>
<p><div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">auto</span> <span class="n">callback</span> <span class="o">=</span> <span class="n">startCatchUpWith</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="n">callback</span><span class="p">)</span> <span class="p">{</span>
  <span class="o">//</span> <span class="n">do</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">maybe</span> <span class="n">multi</span><span class="o">-</span><span class="n">thread</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">dense</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">callback</span><span class="p">();</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span><span class="o">//</span><span class="n">sparse</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="p">:</span> <span class="n">rows_in_block</span><span class="p">)</span> <span class="p">{</span><span class="n">callback</span><span class="p">();}</span>
  <span class="p">}</span>
  <span class="o">//</span> <span class="n">finish</span> <span class="n">catch</span> <span class="n">up</span> <span class="k">with</span><span class="p">,</span> <span class="n">main</span> <span class="n">thread</span>
  <span class="n">finishCatchUpWith</span><span class="p">();</span>
<span class="p">}</span>
Y
Yu Yang 已提交
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534
</pre></div>
</div>
</p>
<p><dl class="docutils">
<dt><strong>Return</strong></dt>
<dd>callback if need catch up with, else return nullptr. It should be no state change. </dd>
</dl>
</p>
</dd></dl>

<dl class="function">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse17finishCatchUpWithEv">
<span id="paddle::OptimizerWithRegularizerSparse::finishCatchUpWith"></span>virtual <span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1af3d22b9d7bd0728ebb56567a060cc28c"></span>void <code class="descname">finishCatchUpWith</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse17finishCatchUpWithEv" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</div>
<div class="breathe-sectiondef container">
<p class="breathe-sectiondef-title rubric">Protected Attributes</p>
<dl class="member">
<dt id="_CPPv2N6paddle30OptimizerWithRegularizerSparse6t0Vec_E">
<span id="paddle::OptimizerWithRegularizerSparse::t0Vec___std::vector:int32_t:"></span><span class="target" id="paddleclasspaddle_1_1OptimizerWithRegularizerSparse_1a62489bf2349d53a4601cb53a5afd37e3"></span>std::vector&lt;int32_t&gt; <code class="descname">t0Vec_</code><a class="headerlink" href="#_CPPv2N6paddle30OptimizerWithRegularizerSparse6t0Vec_E" title="Permalink to this definition"></a></dt>
<dd><p>t0Vec_ are last occur time of i rows if one block is update by multi threads, caller should hash sparse ids to avoid write conflict in t0Vec_. </p>
</dd></dl>

</div>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">Parameter Documents</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../../pserver/client/index.html"
                        title="next chapter">Client Documents</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../../_sources/source/parameter/optimizer/optimizer.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
1535 1536
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
Y
Yu Yang 已提交
1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="../../pserver/client/index.html" title="Client Documents"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="Parameter Documents"
             >previous</a> |</li>
1561 1562 1563
        <li class="nav-item nav-item-0"><a href="../../../index.html">PaddlePaddle  documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../index.html" >Source Code Documents</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" >Parameter Documents</a> &#187;</li> 
Y
Yu Yang 已提交
1564 1565 1566
      </ul>
    </div>
    <div class="footer" role="contentinfo">
1567 1568
        &#169; Copyright 2016, PaddlePaddle developers.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.6.
Y
Yu Yang 已提交
1569 1570 1571
    </div>
  </body>
</html>