Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 1 addition & 55 deletions python/paddle/nn/functional/pooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np

from paddle import _C_ops, _legacy_C_ops, in_dynamic_mode
from paddle import _C_ops, in_dynamic_mode
from paddle.base.framework import (
Variable,
in_dygraph_mode,
Expand Down Expand Up @@ -830,24 +830,6 @@ def max_unpool1d(
x, indices, kernel_size, stride, padding, output_size, data_format
)
return squeeze(output, [2])
elif in_dynamic_mode():
output = _legacy_C_ops.unpool(
x,
indices,
'unpooling_type',
'max',
'ksize',
kernel_size,
'strides',
stride,
'paddings',
padding,
"output_size",
output_size,
"data_format",
data_format,
)
return squeeze(output, [2])

op_type = "unpool"
helper = LayerHelper(op_type, **locals())
Expand Down Expand Up @@ -980,24 +962,6 @@ def max_unpool2d(
x, indices, kernel_size, stride, padding, output_size, data_format
)
return output
elif in_dynamic_mode():
output = _legacy_C_ops.unpool(
x,
indices,
'unpooling_type',
'max',
'ksize',
kernel_size,
'strides',
stride,
'paddings',
padding,
"output_size",
output_size,
"data_format",
data_format,
)
return output

op_type = "unpool"
helper = LayerHelper(op_type, **locals())
Expand Down Expand Up @@ -1127,24 +1091,6 @@ def max_unpool3d(
x, indices, kernel_size, stride, padding, output_size, data_format
)
return output
elif in_dynamic_mode():
output = _legacy_C_ops.unpool3d(
x,
indices,
'unpooling_type',
'max',
'ksize',
kernel_size,
'strides',
stride,
'paddings',
padding,
"output_size",
output_size,
"data_format",
data_format,
)
return output

op_type = "unpool3d"
helper = LayerHelper(op_type, **locals())
Expand Down
27 changes: 1 addition & 26 deletions python/paddle/nn/functional/vision.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,12 @@ def affine_grid(theta, out_shape, align_corners=True, name=None):
False # ROCM platform do not have MIOPEN kernel for affine_grid
)

if in_dygraph_mode():
if in_dynamic_mode():
_out_shape = (
out_shape.tolist() if isinstance(out_shape, Variable) else out_shape
)
theta = theta._use_gpudnn(use_cudnn)
return _C_ops.affine_grid(theta, _out_shape, align_corners)
elif in_dynamic_mode():
_out_shape = (
out_shape.tolist() if isinstance(out_shape, Variable) else out_shape
)
return _legacy_C_ops.affine_grid(
theta,
"output_shape",
_out_shape,
"align_corners",
align_corners,
"use_cudnn",
use_cudnn,
)
elif in_pir_mode():
return _C_ops.affine_grid(
theta,
Expand Down Expand Up @@ -311,18 +298,6 @@ def grid_sample(

if in_dynamic_or_pir_mode():
return _C_ops.grid_sample(x, grid, mode, padding_mode, align_corners)
elif in_dynamic_mode():
attrs = (
'mode',
mode,
'padding_mode',
padding_mode,
'align_corners',
align_corners,
'use_cudnn',
use_cudnn,
)
out = _legacy_C_ops.grid_sampler(x, grid, *attrs)
else:
helper = LayerHelper("grid_sample", **locals())
check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'grid_sample')
Expand Down