Skip to content

Commit

Permalink
Cherrypick1.5 (PaddlePaddle#1028)
Browse files Browse the repository at this point in the history
* add 1.5.1 whl and fix some bugs (PaddlePaddle#1010)

* add windows install whl

* whl and bug

* fix some bugs

* update 1.5.1 cn API

* add url
  • Loading branch information
xsrobin committed Jul 23, 2019
1 parent d5b5f41 commit fa79f48
Show file tree
Hide file tree
Showing 20 changed files with 503 additions and 212 deletions.
1 change: 1 addition & 0 deletions doc/fluid/api_cn/average_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ WeightedAverage

.. code-block:: python
import paddle.fluid as fluid
avg = fluid.average.WeightedAverage()
avg.add(value=2.0, weight=1)
avg.add(value=4.0, weight=2)
Expand Down
1 change: 1 addition & 0 deletions doc/fluid/api_cn/backward_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ append_backward
# 网络配置
# 损失计算
import paddle.fluid as fluid
x = fluid.layers.data(name='x', shape=[13], dtype='float32')
y = fluid.layers.data(name='y', shape=[1], dtype='float32')
Expand Down
23 changes: 8 additions & 15 deletions doc/fluid/api_cn/data/data_reader_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Data Reader Interface
def reader():
while True:
yield numpy.random.uniform(-1, 1, size=width*height)
return reader
return reader
多项目数据读取器创建者的示例实现:
Expand All @@ -249,7 +249,7 @@ Data Reader Interface
def reader():
while True:
yield numpy.random.uniform(-1, 1, size=width*height), label
return reader
return reader
.. py:function:: paddle.reader.map_readers(func, *readers)
Expand Down Expand Up @@ -292,7 +292,7 @@ Data Reader Interface

返回:新的数据读取器

抛出异常: ``ComposeNotAligned`` – reader的输出不一致。 当check_alignment设置为False,不会升高
抛出异常: ``ComposeNotAligned`` – reader的输出不一致。 当check_alignment设置为False,不会抛出异常



Expand Down Expand Up @@ -378,22 +378,15 @@ PipeReader通过流从一个命令中读取数据,将它的stdout放到管道
.. py:method:: get_line(cut_lines=True, line_break='\n')
param cut_lines:
cut buffer to lines
type cut_lines: bool

param line_break:
line break of the file, like

or
参数:
- **cut_lines** (bool) - 将缓冲区分行。
- **line_break** (string) - 文件中的行分割符,比如 ‘\\n’ 或者 ‘\\r’。

type line_break:
string

return: one line or a buffer of bytes
返回:一行或者一段缓冲区。

rtype: string
返回类型: string



Expand Down
1 change: 1 addition & 0 deletions doc/fluid/api_cn/executor_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ scope_guard

.. code-block:: python
import paddle.fluid as fluid
import numpy
new_scope = fluid.Scope()
Expand Down
24 changes: 23 additions & 1 deletion doc/fluid/api_cn/fluid_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ cpu_places
创建 ``fluid.CPUPlace`` 对象列表。

如果 ``device_count`` 为None,则设备数目将由环境变量 ``CPU_NUM`` 确定。如果未设置 ``CPU_NUM`` ,则设备数目将由 ``multiprocessing.cpu_count()`` 确定
如果 ``device_count`` 为None,则设备数目将由环境变量 ``CPU_NUM`` 确定。如果未设置 ``CPU_NUM`` ,则设备数目默认为1,也就是说, ``CPU_NUM`` =1

参数:
- **device_count** (None|int) - 设备数目
Expand All @@ -262,6 +262,7 @@ cpu_places

.. code-block:: python
import paddle.fluid as fluid
cpu_places = fluid.cpu_places()
Expand All @@ -279,6 +280,7 @@ CPUPlace是设备的描述符。它代表一个CPU,可以访问CPUPlace对应

.. code-block:: python
import paddle.fluid as fluid
cpu_place = fluid.CPUPlace()
Expand Down Expand Up @@ -397,6 +399,7 @@ cuda_pinned_places

.. code-block:: python
import paddle.fluid as fluid
cuda_pinned_places_cpu_num = fluid.cuda_pinned_places()
# 或者
cuda_pinned_places = fluid.cuda_pinned_places(1)
Expand Down Expand Up @@ -428,6 +431,7 @@ cuda_places

.. code-block:: python
import paddle.fluid as fluid
cuda_places = fluid.cuda_places()
.. _cn_api_fluid_CUDAPinnedPlace:
Expand All @@ -443,6 +447,7 @@ CUDAPinnedPlace是一个设备描述符,它所指代的存储空间可以被GP

.. code-block:: python
import paddle.fluid as fluid
place = fluid.CUDAPinnedPlace()
.. _cn_api_fluid_CUDAPlace:
Expand All @@ -458,6 +463,7 @@ CUDAPlace是一个设备描述符,它代表一个GPU,并且每个CUDAPlace

.. code-block:: python
import paddle.fluid as fluid
gpu_place = fluid.CUDAPlace(0)
Expand All @@ -482,6 +488,7 @@ DataFeedDesc应由来自磁盘的有效protobuf消息初始化。

.. code-block:: python
import paddle.fluid as fluid
f = open("data.proto", "w")
print >> f, 'name: "MultiSlotDataFeed"'
print >> f, 'batch_size: 2'
Expand All @@ -508,6 +515,7 @@ DataFeedDesc也可以在运行时更改。一旦你熟悉了每个字段的含

.. code-block:: python
import paddle.fluid as fluid
data_feed = fluid.DataFeedDesc('data.proto')
data_feed.set_batch_size(128)
data_feed.set_dense_slots('wd') # 名为'wd'的slot将被设置为密集的
Expand All @@ -534,6 +542,7 @@ DataFeedDesc也可以在运行时更改。一旦你熟悉了每个字段的含

.. code-block:: python
import paddle.fluid as fluid
f = open("data.proto", "w")
print >> f, 'name: "MultiSlotDataFeed"'
print >> f, 'batch_size: 2'
Expand Down Expand Up @@ -569,6 +578,7 @@ DataFeedDesc也可以在运行时更改。一旦你熟悉了每个字段的含

.. code-block:: python
import paddle.fluid as fluid
f = open("data.proto", "w")
print >> f, 'name: "MultiSlotDataFeed"'
print >> f, 'batch_size: 2'
Expand Down Expand Up @@ -606,6 +616,7 @@ DataFeedDesc也可以在运行时更改。一旦你熟悉了每个字段的含

.. code-block:: python
import paddle.fluid as fluid
f = open("data.proto", "w")
print >> f, 'name: "MultiSlotDataFeed"'
print >> f, 'batch_size: 2'
Expand Down Expand Up @@ -642,6 +653,7 @@ DataFeedDesc也可以在运行时更改。一旦你熟悉了每个字段的含

.. code-block:: python
import paddle.fluid as fluid
f = open("data.proto", "w")
print >> f, 'name: "MultiSlotDataFeed"'
print >> f, 'batch_size: 2'
Expand Down Expand Up @@ -993,6 +1005,7 @@ DistributeTranspiler

.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name='x', shape=[13], dtype='float32')
y = fluid.layers.data(name='y', shape=[1], dtype='float32')
y_predict = fluid.layers.fc(input=x, size=1, act=None)
Expand Down Expand Up @@ -1053,6 +1066,7 @@ DistributeTranspiler
.. code-block:: python
import paddle.fluid as fluid
transpiler = fluid.DistributeTranspiler()
t.transpile(
trainer_id=0,
Expand Down Expand Up @@ -1162,6 +1176,7 @@ DistributeTranspiler
.. code-block:: python
import paddle.fluid as fluid
pserver_endpoints = "192.168.0.1:6174,192.168.0.2:6174"
trainer_endpoints = "192.168.0.1:6174,192.168.0.2:6174"
current_endpoint = "192.168.0.1:6174"
Expand Down Expand Up @@ -1207,6 +1222,7 @@ block中分割(split)出的元素个数的最小值。
.. code-block:: python
import paddle.fluid as fluid
config = fluid.DistributeTranspilerConfig()
config.slice_var_up = True
Expand All @@ -1226,6 +1242,7 @@ ExecutionStrategy
.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name='x', shape=[13], dtype='float32')
y = fluid.layers.data(name='y', shape=[1], dtype='float32')
y_predict = fluid.layers.fc(input=x, size=1, act=None)
Expand Down Expand Up @@ -1578,6 +1595,7 @@ in_dygraph_mode

.. code-block:: python
import paddle.fluid as fluid
if fluid.in_dygraph_mode():
pass
Expand Down Expand Up @@ -1875,6 +1893,7 @@ name_scope

.. code-block:: python
import paddle.fluid as fluid
with fluid.name_scope("s1"):
a = fluid.layers.data(name='data', shape=[1], dtype='int32')
b = a + 1
Expand Down Expand Up @@ -2043,6 +2062,7 @@ ParallelExecutor

.. code-block:: python
import paddle.fluid as fluid
pe = fluid.ParallelExecutor(use_cuda=use_cuda,
loss_name=avg_cost.name,
main_program=fluid.default_main_program())
Expand Down Expand Up @@ -2211,6 +2231,7 @@ Program

.. code-block:: python
import paddle.fluid as fluid
test_program = fluid.default_main_program().clone(for_test=True)
optimizer = fluid.optimizer.Momentum(learning_rate=0.01, momentum=0.9)
optimizer.minimize()
Expand Down Expand Up @@ -2538,6 +2559,7 @@ scope_guard

.. code-block:: python
import paddle.fluid as fluid
import numpy
new_scope = fluid.Scope()
Expand Down
7 changes: 7 additions & 0 deletions doc/fluid/api_cn/initializer_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ BilinearInitializer

.. code-block:: python
import paddle.fluid as fluid
factor = 2
C = 2
w_attr = fluid.initializer.ParamAttr(
Expand Down Expand Up @@ -77,6 +78,7 @@ ConstantInitializer

.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name="data", shape=[32, 32], dtype="float32")
fc = fluid.layers.fc(input=x, size=10,
param_attr=fluid.initializer.Constant(value=2.0))
Expand Down Expand Up @@ -104,6 +106,7 @@ force_init_on_cpu

.. code-block:: python
import paddle.fluid as fluid
if fluid.initializer.force_init_on_cpu():
step = fluid.layers.create_global_var(shape=[2,3], value=1.0, dtype='float32')
Expand All @@ -130,6 +133,7 @@ init_on_cpu

.. code-block:: python
import paddle.fluid as fluid
with fluid.initializer.init_on_cpu():
step = fluid.layers.create_global_var(shape=[2,3], value=1.0, dtype='float32')
Expand Down Expand Up @@ -183,6 +187,7 @@ MSRAInitializer

.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name="data", shape=[32, 32], dtype="float32")
fc = fluid.layers.fc(input=x, size=10, param_attr=fluid.initializer.MSRA(uniform=False))
Expand Down Expand Up @@ -219,6 +224,7 @@ NormalInitializer

.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name="data", shape=[32, 32], dtype="float32")
fc = fluid.layers.fc(input=x, size=10,
param_attr=fluid.initializer.Normal(loc=0.0, scale=2.0)
Expand All @@ -240,6 +246,7 @@ NumpyArrayInitializer
.. code-block:: python
import paddle.fluid as fluid
x = fluid.layers.data(name="x", shape=[5], dtype='float32')
fc = fluid.layers.fc(input=x, size=10,
param_attr=fluid.initializer.NumpyArrayInitializer(numpy.array([1,2])))
Expand Down
10 changes: 10 additions & 0 deletions doc/fluid/api_cn/io_cn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ load_params

.. code-block:: python
import paddle.fluid as fluid
exe = fluid.Executor(fluid.CPUPlace())
param_path = "./my_paddle_model"
prog = fluid.default_main_program()
Expand Down Expand Up @@ -131,6 +132,7 @@ load_persistables

.. code-block:: python
import paddle.fluid as fluid
exe = fluid.Executor(fluid.CPUPlace())
param_path = "./my_paddle_model"
prog = fluid.default_main_program()
Expand Down Expand Up @@ -237,6 +239,7 @@ PyReader
.. code-block:: python
import paddle.fluid as fluid
EPOCH_NUM = 3
ITER_NUM = 5
BATCH_SIZE = 3
Expand Down Expand Up @@ -278,6 +281,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
EPOCH_NUM = 3
ITER_NUM = 5
BATCH_SIZE = 10
Expand Down Expand Up @@ -346,6 +350,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
BATCH_SIZE = 10
def generator():
Expand Down Expand Up @@ -376,6 +381,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
BATCH_SIZE = 10
def generator():
Expand Down Expand Up @@ -418,6 +424,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
EPOCH_NUM = 3
ITER_NUM = 15
BATCH_SIZE = 3
Expand Down Expand Up @@ -464,6 +471,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
EPOCH_NUM = 3
ITER_NUM = 15
BATCH_SIZE = 3
Expand Down Expand Up @@ -510,6 +518,7 @@ PyReader

.. code-block:: python
import paddle.fluid as fluid
EPOCH_NUM = 3
ITER_NUM = 15
BATCH_SIZE = 3
Expand Down Expand Up @@ -636,6 +645,7 @@ save_params

.. code-block:: python
import paddle.fluid as fluid
exe = fluid.Executor(fluid.CPUPlace())
param_path = "./my_paddle_model"
prog = fluid.default_main_program()
Expand Down
Loading

0 comments on commit fa79f48

Please sign in to comment.