Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3ce727a8
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
未验证
提交
3ce727a8
编写于
8月 31, 2020
作者:
H
huangjun12
提交者:
GitHub
8月 31, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename Dropout2D/3D to Dropout2d/3d, test=develop (#26796)
rename Dropout2D/3D to Dropout2d/3d
上级
11fb8a1c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
16 deletion
+16
-16
python/paddle/fluid/tests/unittests/test_dropout_op.py
python/paddle/fluid/tests/unittests/test_dropout_op.py
+4
-4
python/paddle/nn/__init__.py
python/paddle/nn/__init__.py
+2
-2
python/paddle/nn/layer/__init__.py
python/paddle/nn/layer/__init__.py
+2
-2
python/paddle/nn/layer/common.py
python/paddle/nn/layer/common.py
+8
-8
未找到文件。
python/paddle/fluid/tests/unittests/test_dropout_op.py
浏览文件 @
3ce727a8
...
...
@@ -530,7 +530,7 @@ class TestDropout2dFAPIError(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
test_dataformat
)
class
TestDropout2
D
CAPI
(
unittest
.
TestCase
):
class
TestDropout2
d
CAPI
(
unittest
.
TestCase
):
def
setUp
(
self
):
np
.
random
.
seed
(
123
)
self
.
places
=
[
fluid
.
CPUPlace
()]
...
...
@@ -543,7 +543,7 @@ class TestDropout2DCAPI(unittest.TestCase):
input_np
=
np
.
random
.
random
([
2
,
3
,
4
,
5
]).
astype
(
"float32"
)
result_np
=
input_np
input
=
fluid
.
dygraph
.
to_variable
(
input_np
)
m
=
paddle
.
nn
.
Dropout2
D
(
p
=
0.
)
m
=
paddle
.
nn
.
Dropout2
d
(
p
=
0.
)
m
.
eval
()
result
=
m
(
input
)
self
.
assertTrue
(
np
.
allclose
(
result
.
numpy
(),
result_np
))
...
...
@@ -616,7 +616,7 @@ class TestDropout3dFAPIError(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
test_dataformat
)
class
TestDropout3
D
CAPI
(
unittest
.
TestCase
):
class
TestDropout3
d
CAPI
(
unittest
.
TestCase
):
def
setUp
(
self
):
np
.
random
.
seed
(
123
)
self
.
places
=
[
fluid
.
CPUPlace
()]
...
...
@@ -629,7 +629,7 @@ class TestDropout3DCAPI(unittest.TestCase):
input_np
=
np
.
random
.
random
([
2
,
3
,
4
,
5
,
6
]).
astype
(
"float32"
)
result_np
=
input_np
input
=
fluid
.
dygraph
.
to_variable
(
input_np
)
m
=
paddle
.
nn
.
Dropout3
D
(
p
=
0.
)
m
=
paddle
.
nn
.
Dropout3
d
(
p
=
0.
)
m
.
eval
()
result
=
m
(
input
)
self
.
assertTrue
(
np
.
allclose
(
result
.
numpy
(),
result_np
))
...
...
python/paddle/nn/__init__.py
浏览文件 @
3ce727a8
...
...
@@ -94,8 +94,8 @@ from .layer.common import UpsamplingNearest2d #DEFINE_ALIAS
from
.layer.common
import
UpsamplingBilinear2d
#DEFINE_ALIAS
from
.layer.common
import
Bilinear
#DEFINE_ALIAS
from
.layer.common
import
Dropout
#DEFINE_ALIAS
from
.layer.common
import
Dropout2
D
#DEFINE_ALIAS
from
.layer.common
import
Dropout3
D
#DEFINE_ALIAS
from
.layer.common
import
Dropout2
d
#DEFINE_ALIAS
from
.layer.common
import
Dropout3
d
#DEFINE_ALIAS
from
.layer.common
import
AlphaDropout
#DEFINE_ALIAS
from
.layer.pooling
import
AvgPool1d
#DEFINE_ALIAS
...
...
python/paddle/nn/layer/__init__.py
浏览文件 @
3ce727a8
...
...
@@ -63,8 +63,8 @@ from .common import UpSample #DEFINE_ALIAS
from
.common
import
UpsamplingNearest2d
#DEFINE_ALIAS
from
.common
import
UpsamplingBilinear2d
#DEFINE_ALIAS
from
.common
import
Dropout
#DEFINE_ALIAS
from
.common
import
Dropout2
D
#DEFINE_ALIAS
from
.common
import
Dropout3
D
#DEFINE_ALIAS
from
.common
import
Dropout2
d
#DEFINE_ALIAS
from
.common
import
Dropout3
d
#DEFINE_ALIAS
from
.common
import
AlphaDropout
#DEFINE_ALIAS
from
.pooling
import
AvgPool1d
#DEFINE_ALIAS
from
.pooling
import
AvgPool2d
#DEFINE_ALIAS
...
...
python/paddle/nn/layer/common.py
浏览文件 @
3ce727a8
...
...
@@ -41,8 +41,8 @@ __all__ = [
'ReplicationPad3d'
,
'CosineSimilarity'
,
'Dropout'
,
'Dropout2
D
'
,
'Dropout3
D
'
,
'Dropout2
d
'
,
'Dropout3
d
'
,
'Bilinear'
,
'AlphaDropout'
,
]
...
...
@@ -766,7 +766,7 @@ class Dropout(layers.Layer):
return
out
class
Dropout2
D
(
layers
.
Layer
):
class
Dropout2
d
(
layers
.
Layer
):
"""
Randomly zero out entire channels (in the batched input 4d tensor with the shape `NCHW` ,
a channel is a 2D feature map with the shape `HW`). Each channel will be zeroed out independently
...
...
@@ -798,7 +798,7 @@ class Dropout2D(layers.Layer):
paddle.disable_static()
x = np.random.random(size=(2, 3, 4, 5)).astype('float32')
x = paddle.to_tensor(x)
m = paddle.nn.Dropout2
D
(p=0.5)
m = paddle.nn.Dropout2
d
(p=0.5)
y_train = m(x)
m.eval() # switch the model to test phase
y_test = m(x)
...
...
@@ -808,7 +808,7 @@ class Dropout2D(layers.Layer):
"""
def
__init__
(
self
,
p
=
0.5
,
data_format
=
'NCHW'
,
name
=
None
):
super
(
Dropout2
D
,
self
).
__init__
()
super
(
Dropout2
d
,
self
).
__init__
()
self
.
p
=
p
self
.
data_format
=
data_format
...
...
@@ -824,7 +824,7 @@ class Dropout2D(layers.Layer):
return
out
class
Dropout3
D
(
layers
.
Layer
):
class
Dropout3
d
(
layers
.
Layer
):
"""
Randomly zero out entire channels (in the batched input 5d tensor with the shape `NCDHW` ,
a channel is a 3D feature map with the shape `DHW` ). Each channel will be zeroed out independently
...
...
@@ -856,7 +856,7 @@ class Dropout3D(layers.Layer):
paddle.disable_static()
x = np.random.random(size=(2, 3, 4, 5, 6)).astype('float32')
x = paddle.to_tensor(x)
m = paddle.nn.Dropout3
D
(p=0.5)
m = paddle.nn.Dropout3
d
(p=0.5)
y_train = m(x)
m.eval() # switch the model to test phase
y_test = m(x)
...
...
@@ -866,7 +866,7 @@ class Dropout3D(layers.Layer):
"""
def
__init__
(
self
,
p
=
0.5
,
data_format
=
'NCDHW'
,
name
=
None
):
super
(
Dropout3
D
,
self
).
__init__
()
super
(
Dropout3
d
,
self
).
__init__
()
self
.
p
=
p
self
.
data_format
=
data_format
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录