未验证 提交 8d0483b4 编写于 作者: C Cheerego 提交者: GitHub

Routine cherrypick 190506 (#846)

* fix_table_link (#837)

* fix_table_link

* fix en

* Update commitid paddle 0428 (#838)

* update_commitid_Paddle_0428

* run gen_doc

* Update metrics_en.rst (#822)

* Update lod_tensor_en.rst (#820)

* update 1.4 releasenote (#839)

* update_releasenote_0428

* add new

* routine_update_190506 (#845)

* fix lod_tensor typo
上级 0f7f706f
......@@ -351,6 +351,14 @@ clip_by_norm
.. autofunction:: paddle.fluid.layers.clip_by_norm
:noindex:
.. _api_fluid_layers_continuous_value_model:
continuous_value_model
----------------------
.. autofunction:: paddle.fluid.layers.continuous_value_model
:noindex:
.. _api_fluid_layers_conv2d:
conv2d
......
......@@ -4,7 +4,7 @@
PaddlePaddle (PArallel Distributed Deep LEarning)是一个易用、高效、灵活、可扩展的深度学习框架
您可参考PaddlePaddle的 `Github <https://github.com/PaddlePaddle/Paddle>`_ 了解详情,也可阅读 `版本说明 <../release_note.html>`_ 了解新版本的特性
您可参考PaddlePaddle的 `Github <https://github.com/PaddlePaddle/Paddle>`_ 了解详情,也可阅读 `版本说明 <../release_note_cn.html>`_ 了解新版本的特性
让我们从这里开始:
......
......@@ -339,11 +339,11 @@ PaddePaddle通过编译时指定路径来实现引用各种BLAS/CUDA/cuDNN库。
<td> - </td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
paddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp35-cp35m-win_amd64.whl">
paddlepaddle-1.4.1-cp35-cp35m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp36-cp36m-win_amd64.whl">
paddlepaddle-1.4.1-cp36-cp36m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp37-cp37m-win_amd64.whl">
paddlepaddle-1.4.1-cp37-cp37m-win_amd64.whl</a></td>
</tr>
<tr>
......
......@@ -417,11 +417,11 @@ You can find the docker image for each release of PaddlePaddle in the [DockerHub
<td> - </td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
paddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp35-cp35m-win_amd64.whl">
paddlepaddle-1.4.1-cp35-cp35m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp36-cp36m-win_amd64.whl">
paddlepaddle-1.4.1-cp36-cp36m-win_amd64.whl</a></td>
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp27-cp27m-win_amd64.whl">
<td> <a href="https://paddle-wheel.bj.bcebos.com/1.4.1-cpu-noavx-openblas-win%2Fpaddlepaddle-1.4.1-cp37-cp37m-win_amd64.whl">
paddlepaddle-1.4.1-cp37-cp37m-win_amd64.whl</a></td>
</tr>
<tr>
......
......@@ -28,9 +28,14 @@ PaddlePaddle目前支持以下环境:
:code:`pip install paddlepaddle-gpu==[PaddlePaddle版本号]` (GPU版,具体版本号请参考 `这里 <https://pypi.org/project/paddlepaddle-gpu/#history>`_ )
- 如果您希望使用 `docker <https://www.docker.com>`_ 安装PaddlePaddle可以直接使用以下命令:
- 如果您希望使用 `docker <https://www.docker.com>`_ 安装PaddlePaddle,可以使用以下命令:
:code:`docker run --name [Name of container] -it -v $PWD:/paddle hub.baidubce.com/paddlepaddle/paddle:[docker版本号] /bin/bash`
如果您的机器不在中国大陆地区,可以直接从DockerHub拉取镜像
:code:`docker run --name [Name of container] -it -v $PWD:/paddle paddlepaddle/paddle:[docker版本号] /bin/bash`
其中[docker版本号]请查阅 `DockerHub <https://hub.docker.com/r/paddlepaddle/paddle/tags/>`_
.. toctree::
......
......@@ -15,7 +15,7 @@ PaddlePaddle currently supports the following environments:
Please make sure your environment meets the conditions above.
And the installation assumes your computer possesses 64-bit operating system, and AVX instruction set is supported by the processor, otherwise you should use the version of :code:`no_avx` in `whl package list - Dev <Tables_en.html/#ciwhls>`_ .
And the installation assumes your computer possesses 64-bit operating system, and AVX instruction set is supported by the processor, otherwise you should use the version of :code:`no_avx` in `whl package list - Dev <Tables_en.html/#ciwhls>`_ .
- If you are planning to use `pip <https://pypi.org/pypi/>`_ to install PaddlePaddle, please type the following commands directly:
......@@ -30,7 +30,7 @@ And the installation assumes your computer possesses 64-bit operating system, an
- If you are planning to use `docker <https://www.docker.com>`_ to install PaddlePaddle, please type the following commands directly:
:code:`docker run --name [Name of container] -it -v $PWD:/paddle hub.baidubce.com/paddlepaddle/paddle:[docker version] /bin/bash`
:code:`docker run --name [Name of container] -it -v $PWD:/paddle paddlepaddle/paddle:[docker version] /bin/bash`
where [docker version] can be looked up in `DockerHub <https://hub.docker.com/r/paddlepaddle/paddle/tags/>`_
......
......@@ -18,7 +18,13 @@
* GPU版的PaddlePaddle: `docker pull hub.baidubce.com/paddlepaddle/paddle:[版本号]-gpu-cuda9.0-cudnn7`
在`:`后请您填写PaddlePaddle版本号,例如1.2,更多请见[镜像简介](#dockers)
如果您的机器不在中国大陆地区,可以直接从DockerHub拉取镜像:
* CPU版的PaddlePaddle: `docker pull paddlepaddle/paddle:[版本号]`
* GPU版的PaddlePaddle: `docker pull paddlepaddle/paddle:[版本号]-gpu-cuda9.0-cudnn7`
在`:`后请您填写PaddlePaddle版本号,例如当前版本,更多请见[镜像简介](#dockers),上例中,`cuda9.0-cudnn7` 也仅作示意用,您可以访问[DockerHub](https://hub.docker.com/r/paddlepaddle/paddle/tags/)获取与您机器适配的镜像。
2. 构建、进入Docker容器
......@@ -35,26 +41,26 @@
<table>
<thead>
<tr>
<th> 版本名称 </th>
<th> 版本说明 </th>
<th> 镜像源 </th>
<th> 镜像说明 </th>
</tr>
</thead>
<tbody>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest </td>
<td> 最新的预先安装好PaddlePaddle CPU版本的镜像 </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:[Version] </td>
<td> 将version换成具体的版本,历史版本的预安装好PaddlePaddle的镜像 </td>
<td> 安装了指定版本PaddlePaddle </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest </td>
<td> 安装了开发版PaddlePaddle。注意:此版本可能包含尚未发布的特性和不稳定的功能,因此不推荐常规用户或在生产环境中使用。 </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest-gpu </td>
<td> 最新的预先安装好PaddlePaddle GPU版本的镜像 </td>
<td> 安装了开发版PaddlePaddle(支持GPU)。注意:此版本可能包含尚未发布的特性和不稳定的功能,因此不推荐常规用户或在生产环境中使用。 </td>
</tr>
<tr>
<td> hub.baidubce.com/paddlepaddle/paddle:latest-dev </td>
<td> 最新的PaddlePaddle的开发环境 </td>
<td> 安装了PaddlePaddle最新的开发环境 </td>
</tr>
</tbody>
</table>
......
......@@ -15,4 +15,4 @@
user_guides/index_cn.rst
advanced_usage/index_cn.rst
api_cn/index_cn.rst
release_note_cn.md
release_note_cn.rst
......@@ -2,12 +2,12 @@
==========================
.. toctree::
:maxdepth: 1
:maxdepth: 1
beginners_guide/index_en.rst
user_guides/index_en.rst
advanced_usage/index_en.rst
api/index_en.rst
release_note_en.md
beginners_guide/index_en.rst
user_guides/index_en.rst
advanced_usage/index_en.rst
api/index_en.rst
release_note_en.rst
......@@ -152,6 +152,10 @@ Take text sequence as an example,[3,1,2] indicates there are 3 articles in the m
recursive_seq_lens is a double Layer nested list, and in other words, the element of the list is list. The size of the outermost list represents the nested layers, namely the size of lod-level; Each inner list represents the size of each element in each lod-level.
The following three pieces of codes introduce how to create LoD-Tensor, how to transform LoD-Tensor to Tensor and how to transform Tensor to LoD-Tensor respectively:
* Create LoD-Tensor
.. code-block:: python
#Create lod-tensor
......@@ -168,13 +172,76 @@ recursive_seq_lens is a double Layer nested list, and in other words, the elemen
fluid.CPUPlace())
#Check lod-tensor nested layers
print len(a.recursive_sequence_lengths())
print (len(a.recursive_sequence_lengths()))
# output2
#Check the number of the most fundamental elements
print sum(a.recursive_sequence_lengths()[-1])
print (sum(a.recursive_sequence_lengths()[-1]))
# output:15 (3+2+4+1+2+3=15)
* Transform LoD-Tensor to Tensor
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
# create LoD-Tensor
a = fluid.create_lod_tensor(np.array([[1.1], [2.2],[3.3],[4.4]]).astype('float32'), [[1,3]], fluid.CPUPlace())
def LodTensor_to_Tensor(lod_tensor):
# get lod information of LoD-Tensor
lod = lod_tensor.lod()
# transform into array
array = np.array(lod_tensor)
new_array = []
# transform to Tensor according to the layer information of the original LoD-Tensor
for i in range(len(lod[0]) - 1):
new_array.append(array[lod[0][i]:lod[0][i + 1]])
return new_array
new_array = LodTensor_to_Tensor(a)
# output the result
print(new_array)
* Transform Tensor to LoD-Tensor
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
def to_lodtensor(data, place):
# save the length of Tensor as LoD information
seq_lens = [len(seq) for seq in data]
cur_len = 0
lod = [cur_len]
for l in seq_lens:
cur_len += l
lod.append(cur_len)
# decrease the dimention of transformed Tensor
flattened_data = np.concatenate(data, axis=0).astype("int64")
flattened_data = flattened_data.reshape([len(flattened_data), 1])
# add lod information to Tensor data
res = fluid.LoDTensor()
res.set(flattened_data, place)
res.set_lod([lod])
return res
# new_array is the transformed Tensor above
lod_tensor = to_lodtensor(new_array,fluid.CPUPlace())
# output LoD information
print("The LoD of the result: {}.".format(lod_tensor.lod()))
# examine the consistency with Tensor data
print("The array : {}.".format(np.array(lod_tensor)))
Code examples
==============
......
......@@ -21,15 +21,15 @@ Fluid contains common classification metrics, such as Precision, Recall, Accurac
.. code-block:: python
>>> import paddle.fluid as fluid
>>> labels = fluid.layers.data(name="data", shape=[1], dtype="int32")
>>> label = fluid.layers.data(name="label", shape=[1], dtype="int32")
>>> data = fluid.layers.data(name="data", shape=[32, 32], dtype="int32")
>>> pred = fluid.layers.fc(input=data, size=1000, act="tanh")
>>> acc = fluid.metrics.Precision()
>>> for pass in range(PASSES):
>>> for pass_iter in range(PASSES):
>>> acc.reset()
>>> for data in train_reader():
>>> loss, preds, labels = exe.run(fetch_list=[cost, preds, labels])
>>> acc.update(preds=preds, labels=labels)
>>> acc.update(preds=preds, labels=labels)
>>> numpy_acc = acc.eval()
......
Subproject commit 2ff867f88628e9cb8b76eaf79045eca0f52e5b85
Subproject commit ef02d06055c79ae9ee11ea9b89520d7185e53482
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册