Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
663f4e61
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
1 年多 前同步成功
通知
696
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
663f4e61
编写于
6月 01, 2018
作者:
B
baiyf
提交者:
qingqing01
6月 01, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bilinear_op Python API (#11117)
* fix conflict * code clean
上级
9503dbb1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
16 deletion
+15
-16
doc/fluid/api/layers.rst
doc/fluid/api/layers.rst
+2
-2
python/paddle/fluid/layers/nn.py
python/paddle/fluid/layers/nn.py
+10
-11
python/paddle/fluid/tests/unittests/test_layers.py
python/paddle/fluid/tests/unittests/test_layers.py
+3
-3
未找到文件。
doc/fluid/api/layers.rst
浏览文件 @
663f4e61
...
...
@@ -1003,10 +1003,10 @@ dice_loss
.. autofunction:: paddle.fluid.layers.dice_loss
:noindex:
upsampling_bilinear2d
resize_bilinear
____
.. autofunction:: paddle.fluid.layers.
upsampling_bilinear2d
.. autofunction:: paddle.fluid.layers.
resize_bilinear
:noindex:
gather
...
...
python/paddle/fluid/layers/nn.py
浏览文件 @
663f4e61
...
...
@@ -81,7 +81,7 @@ __all__ = [
'label_smooth'
,
'roi_pool'
,
'dice_loss'
,
'
upsampling_bilinear2d
'
,
'
resize_bilinear
'
,
'gather'
,
'random_crop'
,
]
...
...
@@ -3929,9 +3929,9 @@ def dice_loss(input, label, epsilon=0.00001):
return
reduce_mean
(
dice_score
)
def
upsampling_bilinear2d
(
input
,
out_shape
=
None
,
scale
=
None
,
name
=
None
):
def
resize_bilinear
(
input
,
out_shape
=
None
,
scale
=
None
,
name
=
None
):
"""
The mathematical meaning of
upsampling_bilinear2d is also called
The mathematical meaning of
resize bilinear layer is
Bilinear interpolation.
Bilinear interpolation is an extension of linear interpolation for
interpolating functions of two variables (e.g. H-direction and
...
...
@@ -3941,13 +3941,13 @@ def upsampling_bilinear2d(input, out_shape=None, scale=None, name=None):
https://en.wikipedia.org/wiki/Bilinear_interpolation
Args:
input (Variable): The input tensor of
bilinear interpolation
,
input (Variable): The input tensor of
resize bilinear layer
,
This is a 4-D tensor of the shape
(num_batches, channels, in_h, in_w).
out_shape(list|tuple|Variable|None): Output shape of
bilinear interpolation
out_shape(list|tuple|Variable|None): Output shape of
resize bilinear
layer, the shape is (out_h, out_w).
Default: None
scale(
in
t|None): The multiplier for the input height or width.
scale(
floa
t|None): The multiplier for the input height or width.
At least one of out_shape or scale must be set.
And out_shape has a higher priority than scale.
Default: None
...
...
@@ -3961,7 +3961,7 @@ def upsampling_bilinear2d(input, out_shape=None, scale=None, name=None):
Examples:
.. code-block:: python
out = fluid.layers.
bilinear_interp
(input, out_shape=[12, 12])
out = fluid.layers.
resize_bilinear
(input, out_shape=[12, 12])
"""
if
out_shape
is
None
and
scale
is
None
:
raise
ValueError
(
"One of out_shape and scale must not be None"
)
...
...
@@ -3975,10 +3975,9 @@ def upsampling_bilinear2d(input, out_shape=None, scale=None, name=None):
out_w
=
0
inputs
=
{
"X"
:
input
}
if
out_shape
is
not
None
:
if
not
(
_is_list_or_turple_
(
out_shape
)
and
len
(
out_shape
)
==
2
)
and
(
out_shape
is
not
Variable
):
raise
ValueError
(
'out_shape should be a list or tuple '
,
'with length 2, (out_h, out_w).'
)
if
not
(
_is_list_or_turple_
(
out_shape
)
and
len
(
out_shape
)
==
2
)
and
not
isinstance
(
out_shape
,
Variable
):
raise
ValueError
(
'out_shape should be a list or tuple or variable'
)
if
_is_list_or_turple_
(
out_shape
):
out_shape
=
list
(
map
(
int
,
out_shape
))
out_h
=
out_shape
[
0
]
...
...
python/paddle/fluid/tests/unittests/test_layers.py
浏览文件 @
663f4e61
...
...
@@ -369,13 +369,13 @@ class TestBook(unittest.TestCase):
self
.
assertIsNotNone
(
output
)
print
(
str
(
program
))
def
test_
upsampling_bilinear2d
(
self
):
def
test_
resize_bilinear
(
self
):
program
=
Program
()
with
program_guard
(
program
):
x
=
layers
.
data
(
name
=
'x'
,
shape
=
[
3
,
9
,
6
],
dtype
=
"float32"
)
output
=
layers
.
upsampling_bilinear2d
(
x
,
out_shape
=
[
12
,
12
])
output
=
layers
.
resize_bilinear
(
x
,
out_shape
=
[
12
,
12
])
self
.
assertIsNotNone
(
output
)
output
=
layers
.
upsampling_bilinear2d
(
x
,
scale
=
3
)
output
=
layers
.
resize_bilinear
(
x
,
scale
=
3
)
self
.
assertIsNotNone
(
output
)
print
(
str
(
program
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录