Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
FluidDoc
提交
404ca8d4
F
FluidDoc
项目概览
PaddlePaddle
/
FluidDoc
通知
5
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
23
列表
看板
标记
里程碑
合并请求
111
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
FluidDoc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
23
Issue
23
列表
看板
标记
里程碑
合并请求
111
合并请求
111
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
404ca8d4
编写于
4月 16, 2020
作者:
C
ceci3
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync ch sample to eng
上级
634b8c50
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
19 addition
and
68 deletion
+19
-68
doc/fluid/api_cn/layers_cn/batch_norm_cn.rst
doc/fluid/api_cn/layers_cn/batch_norm_cn.rst
+3
-12
doc/fluid/api_cn/layers_cn/cos_sim_cn.rst
doc/fluid/api_cn/layers_cn/cos_sim_cn.rst
+2
-10
doc/fluid/api_cn/layers_cn/dropout_cn.rst
doc/fluid/api_cn/layers_cn/dropout_cn.rst
+2
-9
doc/fluid/api_cn/layers_cn/instance_norm_cn.rst
doc/fluid/api_cn/layers_cn/instance_norm_cn.rst
+3
-12
doc/fluid/api_cn/layers_cn/npair_loss_cn.rst
doc/fluid/api_cn/layers_cn/npair_loss_cn.rst
+8
-17
doc/fluid/api_cn/nets_cn/img_conv_group_cn.rst
doc/fluid/api_cn/nets_cn/img_conv_group_cn.rst
+1
-8
未找到文件。
doc/fluid/api_cn/layers_cn/batch_norm_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -67,18 +67,9 @@ moving_mean和moving_var是训练过程中统计得到的全局均值和方差
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
x = fluid.layers.data(name='x', shape=[3, 7, 3, 7], dtype='float32', append_batch_size=False)
hidden1 = fluid.layers.fc(input=x, size=200)
param_attr = fluid.ParamAttr(name='batch_norm_w', initializer=fluid.initializer.Constant(value=1.0))
bias_attr = fluid.ParamAttr(name='batch_norm_b', initializer=fluid.initializer.Constant(value=0.0))
hidden2 = fluid.layers.batch_norm(input=hidden1, param_attr = param_attr, bias_attr = bias_attr)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(3, 7, 3, 7)).astype('float32')
output = exe.run(feed={"x": np_x}, fetch_list = [hidden2])
print(output)
x = fluid.data(name='x', shape=[3, 7, 3, 7], dtype='float32', append_batch_size=False)
hidden1 = fluid.layers.fc(input=x, size=200, param_attr='fc1.w')
hidden2 = fluid.layers.batch_norm(input=hidden1)
.. code-block:: python
...
...
doc/fluid/api_cn/layers_cn/cos_sim_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -28,17 +28,9 @@ cos_sim
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
x = fluid.layers.data(name='x', shape=[3, 7], dtype='float32', append_batch_size=False)
y = fluid.layers.data(name='y', shape=[1, 7], dtype='float32', append_batch_size=False)
x = fluid.data(name='x', shape=[3, 7], dtype='float32')
y = fluid.data(name='y', shape=[1, 7], dtype='float32')
out = fluid.layers.cos_sim(x, y)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(3, 7)).astype('float32')
np_y = np.random.random(size=(1, 7)).astype('float32')
output = exe.run(feed={"x": np_x, "y": np_y}, fetch_list = [out])
print(output)
doc/fluid/api_cn/layers_cn/dropout_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -46,13 +46,6 @@ dropout操作符可以从程序中移除,使程序变得高效。
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
x = fluid.layers.data(name="x", shape=[32, 32], dtype="float32")
droped = fluid.layers.dropout(x, dropout_prob=0.5)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(32, 32)).astype('float32')
output = exe.run(feed={"x": np_x}, fetch_list = [droped])
print(output)
x = fluid.data(name="data", shape=[None, 32, 32], dtype="float32")
dropped = fluid.layers.dropout(x, dropout_prob=0.5)
doc/fluid/api_cn/layers_cn/instance_norm_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -39,16 +39,7 @@ NCHW[batch,in_channels,in_height,in_width]
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
x = fluid.layers.data(name='x', shape=[3, 7, 3, 7], dtype='float32', append_batch_size=False)
hidden1 = fluid.layers.fc(input=x, size=200)
param_attr = fluid.ParamAttr(name='instance_norm_w', initializer=fluid.initializer.Constant(value=1.0))
bias_attr = fluid.ParamAttr(name='instance_norm_b', initializer=fluid.initializer.Constant(value=0.0))
hidden2 = fluid.layers.instance_norm(input=hidden1, param_attr = param_attr, bias_attr = bias_attr)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(3, 7, 3, 7)).astype('float32')
output = exe.run(feed={"x": np_x}, fetch_list = [hidden2])
print(output)
x = fluid.data(name='x', shape=[3, 7, 3, 7], dtype='float32')
hidden1 = fluid.layers.fc(input=x, size=200, param_attr='fc1.w')
hidden2 = fluid.layers.instance_norm(input=hidden1)
doc/fluid/api_cn/layers_cn/npair_loss_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -26,23 +26,14 @@ NPair损失需要成对的数据。NPair损失分为两部分:第一部分是
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
anchor = fluid.layers.data(
name = 'anchor', shape = [18, 6], dtype = 'float32', append_batch_size=False)
positive = fluid.layers.data(
name = 'positive', shape = [18, 6], dtype = 'float32', append_batch_size=False)
labels = fluid.layers.data(
name = 'labels', shape = [18], dtype = 'float32', append_batch_size=False)
res = fluid.layers.npair_loss(anchor, positive, labels, l2_reg = 0.002)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
a = np.random.rand(18, 6).astype("float32")
p = np.random.rand(18, 6).astype("float32")
l = np.random.rand(18).astype("float32")
output = exe.run(feed={"anchor": a, "positive": p, "labels": l}, fetch_list=[res])
print(output)
anchor = fluid.data(
name = 'anchor', shape = [18, 6], dtype = 'float32', append_batch_size=False)
positive = fluid.data(
name = 'positive', shape = [18, 6], dtype = 'float32', append_batch_size=False)
labels = fluid.data(
name = 'labels', shape = [18], dtype = 'float32', append_batch_size=False)
npair_loss = fluid.layers.npair_loss(anchor, positive, labels, l2_reg = 0.002)
...
...
doc/fluid/api_cn/nets_cn/img_conv_group_cn.rst
浏览文件 @
404ca8d4
...
...
@@ -32,8 +32,7 @@ Image Convolution Group由Convolution2d,BatchNorm,DropOut和Pool2d组成。
.. code-block:: python
import paddle.fluid as fluid
import numpy as np
img = fluid.layers.data(name='img', shape=[1, 28, 28], dtype='float32')
img = fluid.data(name='img', shape=[None, 1, 28, 28], dtype='float32')
conv_pool = fluid.nets.img_conv_group(input=img,
conv_padding=1,
conv_num_filter=[3, 3],
...
...
@@ -41,12 +40,6 @@ Image Convolution Group由Convolution2d,BatchNorm,DropOut和Pool2d组成。
conv_act="relu",
pool_size=2,
pool_stride=2)
place = fluid.CPUPlace()
exe = fluid.Executor(place)
exe.run(fluid.default_startup_program())
np_x = np.random.random(size=(1, 1, 28, 28)).astype('float32')
output = exe.run(feed={"img": np_x}, fetch_list = [conv_pool])
print(output)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录