Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5f31737b
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看板
未验证
提交
5f31737b
编写于
9月 13, 2021
作者:
X
xiaoting
提交者:
GitHub
9月 13, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix interpolate launch error (#35577)
* fix interpolate launch error, test=develop * fix area mode for interp, test=develop
上级
e641c638
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
37 addition
and
35 deletion
+37
-35
paddle/fluid/operators/interpolate_v2_op.cu
paddle/fluid/operators/interpolate_v2_op.cu
+26
-26
python/paddle/nn/functional/common.py
python/paddle/nn/functional/common.py
+11
-9
未找到文件。
paddle/fluid/operators/interpolate_v2_op.cu
浏览文件 @
5f31737b
...
...
@@ -1035,9 +1035,9 @@ static void Interpolate1DCUDAFwd(const framework::ExecutionContext& ctx,
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_cw
=
c
*
in_w
;
int
out_cw
=
c
*
out_w
;
int
pixelNum
=
n
*
out_cw
;
int
64_t
in_cw
=
c
*
in_w
;
int
64_t
out_cw
=
c
*
out_w
;
auto
pixelNum
=
n
*
out_cw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
@@ -1169,12 +1169,12 @@ static void Interpolate2DCUDAFwd(const framework::ExecutionContext& ctx,
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_hw
=
in_h
*
in_w
;
int
out_hw
=
out_h
*
out_w
;
int
in_chw
=
c
*
in_hw
;
int
out_chw
=
c
*
out_hw
;
int
64_t
in_hw
=
in_h
*
in_w
;
int
64_t
out_hw
=
out_h
*
out_w
;
int
64_t
in_chw
=
c
*
in_hw
;
int
64_t
out_chw
=
c
*
out_hw
;
int
pixelNum
=
n
*
out_chw
;
auto
pixelNum
=
n
*
out_chw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
@@ -1355,12 +1355,12 @@ static void Interpolate3DCUDAFwd(const framework::ExecutionContext& ctx,
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_dhw
=
in_d
*
in_h
*
in_w
;
int
out_dhw
=
out_d
*
out_h
*
out_w
;
int
in_cdhw
=
c
*
in_dhw
;
int
out_cdhw
=
c
*
out_dhw
;
int
64_t
in_dhw
=
in_d
*
in_h
*
in_w
;
int
64_t
out_dhw
=
out_d
*
out_h
*
out_w
;
int
64_t
in_cdhw
=
c
*
in_dhw
;
int
64_t
out_cdhw
=
c
*
out_dhw
;
int
pixelNum
=
n
*
out_cdhw
;
auto
pixelNum
=
n
*
out_cdhw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
@@ -1456,9 +1456,9 @@ static void Interpolate1DCUDABwd(const framework::ExecutionContext& ctx,
ratio_w
=
(
align_corners
)
?
static_cast
<
float
>
(
in_w
-
1
)
/
(
out_w
-
1
)
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_cw
=
c
*
in_w
;
int
out_cw
=
c
*
out_w
;
int
pixelNum
=
n
*
out_cw
;
int
64_t
in_cw
=
c
*
in_w
;
int
64_t
out_cw
=
c
*
out_w
;
auto
pixelNum
=
n
*
out_cw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
@@ -1587,11 +1587,11 @@ static void Interpolate2DCUDABwd(const framework::ExecutionContext& ctx,
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_hw
=
in_h
*
in_w
;
int
out_hw
=
out_h
*
out_w
;
int
in_chw
=
c
*
in_hw
;
int
out_chw
=
c
*
out_hw
;
int
pixelNum
=
n
*
out_chw
;
int
64_t
in_hw
=
in_h
*
in_w
;
int
64_t
out_hw
=
out_h
*
out_w
;
int
64_t
in_chw
=
c
*
in_hw
;
int
64_t
out_chw
=
c
*
out_hw
;
auto
pixelNum
=
n
*
out_chw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
@@ -1773,12 +1773,12 @@ static void Interpolate3DCUDABwd(const framework::ExecutionContext& ctx,
:
static_cast
<
float
>
(
new_scale_w
);
}
int
in_dhw
=
in_d
*
in_h
*
in_w
;
int
out_dhw
=
out_d
*
out_h
*
out_w
;
int
in_cdhw
=
c
*
in_dhw
;
int
out_cdhw
=
c
*
out_dhw
;
int
64_t
in_dhw
=
in_d
*
in_h
*
in_w
;
int
64_t
out_dhw
=
out_d
*
out_h
*
out_w
;
int
64_t
in_cdhw
=
c
*
in_dhw
;
int
64_t
out_cdhw
=
c
*
out_dhw
;
int
pixelNum
=
n
*
out_cdhw
;
auto
pixelNum
=
n
*
out_cdhw
;
platform
::
GpuLaunchConfig
config
=
platform
::
GetGpuLaunchConfig1D
(
ctx
.
cuda_device_context
(),
pixelNum
);
...
...
python/paddle/nn/functional/common.py
浏览文件 @
5f31737b
...
...
@@ -295,13 +295,16 @@ def interpolate(x,
"align_corners option can only be set with the interpolating modes: linear | bilinear | bicubic | trilinear"
)
if
resample
==
'AREA'
and
len
(
x
.
shape
)
==
3
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool1d
(
x
,
size
)
if
resample
==
'AREA'
and
len
(
x
.
shape
)
==
4
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool2d
(
x
,
size
)
if
resample
==
'AREA'
and
len
(
x
.
shape
)
==
5
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool3d
(
x
,
size
)
if
resample
==
'AREA'
:
if
isinstance
(
size
,
list
)
or
isinstance
(
size
,
tuple
):
if
len
(
size
)
==
0
:
raise
ValueError
(
"output size can not be empty"
)
if
len
(
x
.
shape
)
==
3
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool1d
(
x
,
size
)
elif
len
(
x
.
shape
)
==
4
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool2d
(
x
,
size
)
elif
len
(
x
.
shape
)
==
5
:
return
paddle
.
nn
.
functional
.
adaptive_avg_pool3d
(
x
,
size
)
helper
=
LayerHelper
(
'{}_interp_v2'
.
format
(
resample_type
),
**
locals
())
dtype
=
helper
.
input_dtype
(
input_param_name
=
'x'
)
...
...
@@ -342,14 +345,13 @@ def interpolate(x,
out_shape
=
size
scale
=
scale_factor
if
out_shape
is
not
None
and
scale
is
not
None
:
raise
ValueError
(
"Only one of size or scale_factor should be defined."
)
if
out_shape
is
not
None
:
if
isinstance
(
out_shape
,
Variable
)
and
not
in_dygraph_mode
():
out_shape
.
stop_gradient
=
True
inputs
[
'OutSize'
]
=
out_shape
else
:
if
in_dygraph_mode
():
if
isinstance
(
out_shape
,
Variable
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录