Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
652e655f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
652e655f
编写于
9月 17, 2021
作者:
X
xiaoting
提交者:
GitHub
9月 17, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix unpool doc, test=document_fix (#35806)
* fix unpool doc, test=document_fix * fix typo for python example, test=document_fix
上级
00865930
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
6 addition
and
22 deletion
+6
-22
python/paddle/nn/functional/pooling.py
python/paddle/nn/functional/pooling.py
+2
-12
python/paddle/nn/layer/pooling.py
python/paddle/nn/layer/pooling.py
+4
-10
未找到文件。
python/paddle/nn/functional/pooling.py
浏览文件 @
652e655f
...
@@ -674,17 +674,8 @@ def max_unpool2d(x,
...
@@ -674,17 +674,8 @@ def max_unpool2d(x,
name
=
None
):
name
=
None
):
"""
"""
This API implements max unpooling 2d opereation.
This API implements max unpooling 2d opereation.
See more details in :ref:`api_nn_pooling_MaxUnPool2D` .
`max_unpool2d` is not fully invertible, since the non-maximal values are lost.
`max_unpool2d` takes in as input the output of `max_unpool2d`
including the indices of the maximal values and computes a partial inverse
in which all non-maximal values are set to zero.
`max_unpool2d` can map several input sizes to the same output
sizes. Hence, the inversion process can get ambiguous.
To accommodate this, you can provide the needed output size
as an additional argument `output_size` in the forward call.
Args:
Args:
x (Tensor): The input tensor of unpooling operator which is a 4-D tensor with
x (Tensor): The input tensor of unpooling operator which is a 4-D tensor with
...
@@ -735,9 +726,8 @@ def max_unpool2d(x,
...
@@ -735,9 +726,8 @@ def max_unpool2d(x,
import paddle
import paddle
import paddle.nn.functional as F
import paddle.nn.functional as F
import numpy as np
data = paddle.
to_tensor(np.random.uniform(-1, 1, [1, 1, 6, 6]).astype(np.float32)
)
data = paddle.
rand(shape=[1,1,6,6]
)
pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
# pool_out shape: [1, 1, 3, 3], indices shape: [1, 1, 3, 3]
# pool_out shape: [1, 1, 3, 3], indices shape: [1, 1, 3, 3]
unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0)
unpool_out = F.max_unpool2d(pool_out, indices, kernel_size=2, padding=0)
...
...
python/paddle/nn/layer/pooling.py
浏览文件 @
652e655f
...
@@ -1134,16 +1134,10 @@ class MaxUnPool2D(Layer):
...
@@ -1134,16 +1134,10 @@ class MaxUnPool2D(Layer):
"""
"""
This API implements max unpooling 2d opereation.
This API implements max unpooling 2d opereation.
`max_unpool2d` is not fully invertible, since the non-maximal values are lost.
'max_unpool2d' accepts the output of 'max_unpool2d' as input
Including the indices of the maximum value and calculating the partial inverse
All non-maximum values are set to zero.
`max_unpool2d` takes in as input the output of `max_unpool2d`
including the indices of the maximal values and computes a partial inverse
in which all non-maximal values are set to zero.
`max_unpool2d` can map several input sizes to the same output
sizes. Hence, the inversion process can get ambiguous.
To accommodate this, you can provide the needed output size
as an additional argument `output_size` in the forward call.
Parameters:
Parameters:
kernel_size (int|list|tuple): The unpool kernel size. If unpool kernel size is a tuple or list,
kernel_size (int|list|tuple): The unpool kernel size. If unpool kernel size is a tuple or list,
...
@@ -1183,7 +1177,7 @@ class MaxUnPool2D(Layer):
...
@@ -1183,7 +1177,7 @@ class MaxUnPool2D(Layer):
import paddle.nn.functional as F
import paddle.nn.functional as F
import numpy as np
import numpy as np
data = paddle.
to_tensor(np.random.uniform(-1, 1, [1, 1, 7, 7]).astype(np.float32)
)
data = paddle.
rand(shape=[1,1,7,7]
)
pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
pool_out, indices = F.max_pool2d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
# pool_out shape: [1, 1, 3, 3], indices shape: [1, 1, 3, 3]
# pool_out shape: [1, 1, 3, 3], indices shape: [1, 1, 3, 3]
Unpool2D = paddle.nn.MaxUnPool2D(kernel_size=2, padding=0)
Unpool2D = paddle.nn.MaxUnPool2D(kernel_size=2, padding=0)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录