Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e7caf3b8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
e7caf3b8
编写于
11月 26, 2020
作者:
C
ceci3
提交者:
GitHub
11月 26, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix examples, test=document_fix (#29019)
* fix examples, test=document_fix * fix, test=document_fix
上级
db412585
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
8 addition
and
15 deletion
+8
-15
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+5
-6
python/paddle/nn/layer/activation.py
python/paddle/nn/layer/activation.py
+0
-3
python/paddle/nn/layer/norm.py
python/paddle/nn/layer/norm.py
+3
-4
python/paddle/nn/utils/weight_norm_hook.py
python/paddle/nn/utils/weight_norm_hook.py
+0
-2
未找到文件。
python/paddle/fluid/layers/nn.py
浏览文件 @
e7caf3b8
...
...
@@ -3126,7 +3126,7 @@ def instance_norm(input,
`H` means height of feature map, `W` means width of feature map.
Args:
input(
variable): The rank of input variable
can be 2, 3, 4, 5.
input(
Tensor): The rank of input tensor
can be 2, 3, 4, 5.
The data type is float32 or float64.
epsilon(float, Default 1e-05): A value added to the denominator for
numerical stability. Default is 1e-5.
...
...
@@ -3146,19 +3146,18 @@ def instance_norm(input,
will be named automatically.
Returns:
A
Variable holding
Tensor which is the result after applying instance normalization on the input,
A Tensor which is the result after applying instance normalization on the input,
has same shape and data type with input.
Examples:
.. code-block:: python
import paddle.fluid as fluid
import paddle
paddle.enable_static()
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)
x =
paddle.static
.data(name='x', shape=[3, 7, 3, 7], dtype='float32')
hidden1 =
paddle.static.nn.fc(x, size=200
)
hidden2 =
paddle.static.nn.instance_norm(
hidden1)
"""
check_variable_and_dtype(input, 'input', ['float32', 'float64'],
'instance_norm')
...
...
python/paddle/nn/layer/activation.py
浏览文件 @
e7caf3b8
...
...
@@ -515,9 +515,6 @@ class LeakyReLU(layers.Layer):
.. code-block:: python
import paddle
import numpy as np
paddle.disable_static()
m = paddle.nn.LeakyReLU()
x = paddle.to_tensor(np.array([-2, 0, 1], 'float32'))
...
...
python/paddle/nn/layer/norm.py
浏览文件 @
e7caf3b8
...
...
@@ -996,12 +996,12 @@ class SyncBatchNorm(_BatchNormBase):
import numpy as np
x = np.array([[[[0.3, 0.4], [0.3, 0.07]], [[0.83, 0.37], [0.18, 0.93]]]]).astype('float32')
paddle.disable_static()
x = paddle.to_tensor(x)
if paddle.fluid.is_compiled_with_cuda():
if paddle.is_compiled_with_cuda():
sync_batch_norm = nn.SyncBatchNorm(2)
hidden1 = sync_batch_norm(x)
print(hidden1
.numpy()
)
print(hidden1)
# [[[[0.26824948, 1.0936325],[0.26824948, -1.6301316]],[[ 0.8095662, -0.665287],[-1.2744656, 1.1301866 ]]]]
"""
...
...
@@ -1096,7 +1096,6 @@ class SyncBatchNorm(_BatchNormBase):
import paddle
import paddle.nn as nn
paddle.disable_static()
model = nn.Sequential(nn.Conv2D(3, 5, 3), nn.BatchNorm2D(5))
sync_model = nn.SyncBatchNorm.convert_sync_batchnorm(model)
...
...
python/paddle/nn/utils/weight_norm_hook.py
浏览文件 @
e7caf3b8
...
...
@@ -188,7 +188,6 @@ def weight_norm(layer, name='weight', dim=0):
from paddle.nn.utils import weight_norm
x = np.array([[[[0.3, 0.4], [0.3, 0.07]], [[0.83, 0.37], [0.18, 0.93]]]]).astype('float32')
paddle.disable_static()
conv = Conv2D(3, 5, 3)
wn = weight_norm(conv)
print(conv.weight_g.shape)
...
...
@@ -217,7 +216,6 @@ def remove_weight_norm(layer, name='weight'):
from paddle.nn import Conv2D
from paddle.nn.utils import weight_norm, remove_weight_norm
paddle.disable_static()
conv = Conv2D(3, 5, 3)
wn = weight_norm(conv)
remove_weight_norm(conv)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录