提交 cf95bc3a 编写于 作者: T Travis CI

Deploy to GitHub Pages: 2f82d72e

上级 ac963590
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -751,14 +751,13 @@ compute attention weight.</li> ...@@ -751,14 +751,13 @@ compute attention weight.</li>
<dl class="function"> <dl class="function">
<dt> <dt>
<code class="descclassname">paddle.trainer_config_helpers.networks.</code><code class="descname">outputs</code><span class="sig-paren">(</span><em>layers</em>, <em>*args</em><span class="sig-paren">)</span></dt> <code class="descclassname">paddle.trainer_config_helpers.networks.</code><code class="descname">outputs</code><span class="sig-paren">(</span><em>layers</em>, <em>*args</em><span class="sig-paren">)</span></dt>
<dd><p>Declare the end of network. Currently it will only calculate the <dd><p>Declare the outputs of network. If user have not defined the inputs of
input/output order of network. It will calculate the predict network or network, this method will calculate the input order by dfs travel.</p>
train network&#8217;s output automatically.</p>
<table class="docutils field-list" frame="void" rules="none"> <table class="docutils field-list" frame="void" rules="none">
<col class="field-name" /> <col class="field-name" />
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>layers</strong> (<em>list|tuple|LayerOutput</em>) &#8211; </td> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>layers</strong> (<em>list|tuple|LayerOutput</em>) &#8211; Output layers.</td>
</tr> </tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr> </tr>
......
...@@ -199,10 +199,10 @@ the <code class="code docutils literal"><span class="pre">dataprovider</span></c ...@@ -199,10 +199,10 @@ the <code class="code docutils literal"><span class="pre">dataprovider</span></c
<span class="c1"># Define a py data provider</span> <span class="c1"># Define a py data provider</span>
<span class="nd">@provider</span><span class="p">(</span><span class="n">input_types</span><span class="o">=</span><span class="p">[</span> <span class="nd">@provider</span><span class="p">(</span><span class="n">input_types</span><span class="o">=</span><span class="p">{</span>
<span class="n">dense_vector</span><span class="p">(</span><span class="mi">28</span> <span class="o">*</span> <span class="mi">28</span><span class="p">),</span> <span class="s1">&#39;pixel&#39;</span><span class="p">:</span> <span class="n">dense_vector</span><span class="p">(</span><span class="mi">28</span> <span class="o">*</span> <span class="mi">28</span><span class="p">),</span>
<span class="n">integer_value</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="n">integer_value</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="p">])</span> <span class="p">})</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span> <span class="c1"># settings is not used currently.</span> <span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span> <span class="c1"># settings is not used currently.</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="c1"># open one of training file</span> <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="c1"># open one of training file</span>
...@@ -217,7 +217,7 @@ the <code class="code docutils literal"><span class="pre">dataprovider</span></c ...@@ -217,7 +217,7 @@ the <code class="code docutils literal"><span class="pre">dataprovider</span></c
<span class="n">pixels_float</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">each_pixel_str</span><span class="p">))</span> <span class="n">pixels_float</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">each_pixel_str</span><span class="p">))</span>
<span class="c1"># give data to paddle.</span> <span class="c1"># give data to paddle.</span>
<span class="k">yield</span> <span class="p">{</span> <span class="s2">&quot;pixel&quot;</span><span class="p">:</span> <span class="n">pixels_float</span><span class="p">,</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="n">label</span><span class="p">)</span> <span class="p">}</span> <span class="k">yield</span> <span class="p">{</span><span class="s2">&quot;pixel&quot;</span><span class="p">:</span> <span class="n">pixels_float</span><span class="p">,</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="n">label</span><span class="p">)}</span>
<span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <span class="c1"># close file</span> <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <span class="c1"># close file</span>
</pre></div> </pre></div>
...@@ -355,7 +355,7 @@ Please refer to the following section reference for details.</p> ...@@ -355,7 +355,7 @@ Please refer to the following section reference for details.</p>
<h3>&#64;provider<a class="headerlink" href="#provider" title="Permalink to this headline"></a></h3> <h3>&#64;provider<a class="headerlink" href="#provider" title="Permalink to this headline"></a></h3>
<dl class="function"> <dl class="function">
<dt id="paddle.trainer.PyDataProvider2.provider"> <dt id="paddle.trainer.PyDataProvider2.provider">
<code class="descclassname">paddle.trainer.PyDataProvider2.</code><code class="descname">provider</code><span class="sig-paren">(</span><em>input_types=None</em>, <em>should_shuffle=None</em>, <em>pool_size=-1</em>, <em>min_pool_size=-1</em>, <em>can_over_batch_size=True</em>, <em>calc_batch_size=None</em>, <em>cache=0</em>, <em>check=False</em>, <em>check_fail_continue=False</em>, <em>use_dynamic_order=True</em>, <em>init_hook=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#paddle.trainer.PyDataProvider2.provider" title="Permalink to this definition"></a></dt> <code class="descclassname">paddle.trainer.PyDataProvider2.</code><code class="descname">provider</code><span class="sig-paren">(</span><em>input_types=None</em>, <em>should_shuffle=None</em>, <em>pool_size=-1</em>, <em>min_pool_size=-1</em>, <em>can_over_batch_size=True</em>, <em>calc_batch_size=None</em>, <em>cache=0</em>, <em>check=False</em>, <em>check_fail_continue=False</em>, <em>init_hook=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#paddle.trainer.PyDataProvider2.provider" title="Permalink to this definition"></a></dt>
<dd><p>Provider decorator. Use it to make a function into PyDataProvider2 object. <dd><p>Provider decorator. Use it to make a function into PyDataProvider2 object.
In this function, user only need to get each sample for some train/test In this function, user only need to get each sample for some train/test
file.</p> file.</p>
...@@ -373,8 +373,13 @@ file.</p> ...@@ -373,8 +373,13 @@ file.</p>
<col class="field-body" /> <col class="field-body" />
<tbody valign="top"> <tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>input_types</strong> (<em>list|tuple</em>) &#8211; Specify the input types, can also be set in init_hook. <li><strong>input_types</strong> (<em>list|tuple|dict</em>) &#8211; Specify the input types, can also be set in init_hook.
It is a list of InputType object. For example, input_types= [dense_vector(9), integer_value(2)].</li> It could be a list of InputType object. For example,
input_types=[dense_vector(9), integer_value(2)]. Or user
can set a dict of InputType object, which key is
data_layer&#8217;s name. For example, input_types= {&#8216;img&#8217;: img_features, &#8216;label&#8217;: label}. when using dict of
InputType, user could yield a dict of feature values, which
key is also data_layer&#8217;s name.</li>
<li><strong>should_shuffle</strong> (<em>bool</em>) &#8211; True if data should shuffle. Pass None means shuffle <li><strong>should_shuffle</strong> (<em>bool</em>) &#8211; True if data should shuffle. Pass None means shuffle
when is training and not to shuffle when is testing.</li> when is training and not to shuffle when is testing.</li>
<li><strong>pool_size</strong> (<em>int</em>) &#8211; Max number of sample in data pool.</li> <li><strong>pool_size</strong> (<em>int</em>) &#8211; Max number of sample in data pool.</li>
...@@ -409,10 +414,6 @@ for debug. Default is disabled.</li> ...@@ -409,10 +414,6 @@ for debug. Default is disabled.</li>
<li><strong>check_fail_continue</strong> (<em>bool</em>) &#8211; Continue train or not when check failed. Just <li><strong>check_fail_continue</strong> (<em>bool</em>) &#8211; Continue train or not when check failed. Just
drop the wrong format data when it is True. Has drop the wrong format data when it is True. Has
no effect when check set to False.</li> no effect when check set to False.</li>
<li><strong>use_dynamic_order</strong> (<em>bool</em>) &#8211; Allow provider to yield a dictionary object, whose
key is a input data layer name, and value is the
feature value. The tuples are still allowed when
use_dynmaic_order is True.</li>
</ul> </ul>
</td> </td>
</tr> </tr>
......
...@@ -141,8 +141,6 @@ DataProvider创建的时候执行。这个初始化函数具有如下参数: ...@@ -141,8 +141,6 @@ DataProvider创建的时候执行。这个初始化函数具有如下参数:
是一个batch size,但是有时为了计算均衡性,可以将一条数据设置成多个batch size 是一个batch size,但是有时为了计算均衡性,可以将一条数据设置成多个batch size
* cache 是数据缓存的策略,参考 `cache`_ * cache 是数据缓存的策略,参考 `cache`_
* init_hook 是初始化时调用的函数,参考 `init_hook`_ * init_hook 是初始化时调用的函数,参考 `init_hook`_
* use_dynamic_order 如果是true的话,可以返回一个dict,key是data_layer的名字,value是特征值。同时,也可以
返回一个list或者tuple。如果是false的话,只能够返回list或者tuple
* check 设置成true的话,会根据input_types检查数据的合法性。 * check 设置成true的话,会根据input_types检查数据的合法性。
* check_fail_continue 如果设置成true的话,即使在check中数据不合法,也会扔到这条数据,继续训练。 如果 * check_fail_continue 如果设置成true的话,即使在check中数据不合法,也会扔到这条数据,继续训练。 如果
check是false的话,没有作用。 check是false的话,没有作用。
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
...@@ -189,10 +189,10 @@ process函数调用多次 <code class="code docutils literal"><span class="pre"> ...@@ -189,10 +189,10 @@ process函数调用多次 <code class="code docutils literal"><span class="pre">
<span class="c1"># Define a py data provider</span> <span class="c1"># Define a py data provider</span>
<span class="nd">@provider</span><span class="p">(</span><span class="n">input_types</span><span class="o">=</span><span class="p">[</span> <span class="nd">@provider</span><span class="p">(</span><span class="n">input_types</span><span class="o">=</span><span class="p">{</span>
<span class="n">dense_vector</span><span class="p">(</span><span class="mi">28</span> <span class="o">*</span> <span class="mi">28</span><span class="p">),</span> <span class="s1">&#39;pixel&#39;</span><span class="p">:</span> <span class="n">dense_vector</span><span class="p">(</span><span class="mi">28</span> <span class="o">*</span> <span class="mi">28</span><span class="p">),</span>
<span class="n">integer_value</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="n">integer_value</span><span class="p">(</span><span class="mi">10</span><span class="p">)</span>
<span class="p">])</span> <span class="p">})</span>
<span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span> <span class="c1"># settings is not used currently.</span> <span class="k">def</span> <span class="nf">process</span><span class="p">(</span><span class="n">settings</span><span class="p">,</span> <span class="n">filename</span><span class="p">):</span> <span class="c1"># settings is not used currently.</span>
<span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="c1"># open one of training file</span> <span class="n">f</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;r&#39;</span><span class="p">)</span> <span class="c1"># open one of training file</span>
...@@ -207,7 +207,7 @@ process函数调用多次 <code class="code docutils literal"><span class="pre"> ...@@ -207,7 +207,7 @@ process函数调用多次 <code class="code docutils literal"><span class="pre">
<span class="n">pixels_float</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">each_pixel_str</span><span class="p">))</span> <span class="n">pixels_float</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">each_pixel_str</span><span class="p">))</span>
<span class="c1"># give data to paddle.</span> <span class="c1"># give data to paddle.</span>
<span class="k">yield</span> <span class="p">{</span> <span class="s2">&quot;pixel&quot;</span><span class="p">:</span> <span class="n">pixels_float</span><span class="p">,</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="n">label</span><span class="p">)</span> <span class="p">}</span> <span class="k">yield</span> <span class="p">{</span><span class="s2">&quot;pixel&quot;</span><span class="p">:</span> <span class="n">pixels_float</span><span class="p">,</span> <span class="s1">&#39;label&#39;</span><span class="p">:</span> <span class="nb">int</span><span class="p">(</span><span class="n">label</span><span class="p">)}</span>
<span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <span class="c1"># close file</span> <span class="n">f</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> <span class="c1"># close file</span>
</pre></div> </pre></div>
...@@ -340,8 +340,6 @@ DataProvider创建的时候执行。这个初始化函数具有如下参数:</p> ...@@ -340,8 +340,6 @@ DataProvider创建的时候执行。这个初始化函数具有如下参数:</p>
是一个batch size,但是有时为了计算均衡性,可以将一条数据设置成多个batch size</li> 是一个batch size,但是有时为了计算均衡性,可以将一条数据设置成多个batch size</li>
<li>cache 是数据缓存的策略,参考 <a class="reference internal" href="#cache">cache</a></li> <li>cache 是数据缓存的策略,参考 <a class="reference internal" href="#cache">cache</a></li>
<li>init_hook 是初始化时调用的函数,参考 <a class="reference internal" href="#init-hook">init_hook</a></li> <li>init_hook 是初始化时调用的函数,参考 <a class="reference internal" href="#init-hook">init_hook</a></li>
<li>use_dynamic_order 如果是true的话,可以返回一个dict,key是data_layer的名字,value是特征值。同时,也可以
返回一个list或者tuple。如果是false的话,只能够返回list或者tuple</li>
<li>check 设置成true的话,会根据input_types检查数据的合法性。</li> <li>check 设置成true的话,会根据input_types检查数据的合法性。</li>
<li>check_fail_continue 如果设置成true的话,即使在check中数据不合法,也会扔到这条数据,继续训练。 如果 <li>check_fail_continue 如果设置成true的话,即使在check中数据不合法,也会扔到这条数据,继续训练。 如果
check是false的话,没有作用。</li> check是false的话,没有作用。</li>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册