Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.0rc cherry pick api rename #28108 #28184

Merged
merged 7 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ def __init__(self,
bias_attr=False)

self._sync_batch_norm2 = SyncBatchNorm(
num_filters,
weight_attr=False,
bias_attr=False,
track_running_stats=False)
num_filters, weight_attr=False, bias_attr=False)

def forward(self, inputs):
y = self._conv(inputs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_dynamic_graph(self):
x = paddle.to_tensor(self.x_np)

out_1 = paddle.nn.functional.adaptive_max_pool2d(
x=x, return_indices=False, output_size=[3, 3])
x=x, return_mask=False, output_size=[3, 3])

out_2 = paddle.nn.functional.adaptive_max_pool2d(x=x, output_size=5)

Expand Down
23 changes: 12 additions & 11 deletions python/paddle/fluid/tests/unittests/test_pool1d_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def avg_pool1D_forward_naive(x,
return out


class TestPool1d_API(unittest.TestCase):
class TestPool1D_API(unittest.TestCase):
def setUp(self):
np.random.seed(123)
self.places = [fluid.CPUPlace()]
Expand Down Expand Up @@ -138,7 +138,7 @@ def check_avg_dygraph_results(self, place):

self.assertTrue(np.allclose(result.numpy(), result_np))

avg_pool1d_dg = paddle.nn.layer.AvgPool1d(
avg_pool1d_dg = paddle.nn.layer.AvgPool1D(
kernel_size=2, stride=None, padding=0)
result = avg_pool1d_dg(input)
self.assertTrue(np.allclose(result.numpy(), result_np))
Expand All @@ -148,19 +148,20 @@ def check_avg_dygraph_padding_results(self, place):
input_np = np.random.random([2, 3, 32]).astype("float32")
input = fluid.dygraph.to_variable(input_np)
result = F.avg_pool1d(
input,
kernel_size=2,
stride=2,
padding=[1],
count_include_pad=True)
input, kernel_size=2, stride=2, padding=[1], exclusive=True)

result_np = avg_pool1D_forward_naive(
input_np, ksize=[2], strides=[2], paddings=[1], exclusive=False)

self.assertTrue(np.allclose(result.numpy(), result_np))

<<<<<<< HEAD
avg_pool1d_dg = paddle.nn.AvgPool1d(
kernel_size=2, stride=None, padding=1, exclusive=True)
=======
avg_pool1d_dg = paddle.nn.AvgPool1D(
kernel_size=2, stride=None, padding=1, count_include_pad=True)
>>>>>>> 7c1aa0d69dd21d7db98b1c46873f3a028e344e95
result = avg_pool1d_dg(input)
self.assertTrue(np.allclose(result.numpy(), result_np))

Expand Down Expand Up @@ -190,7 +191,7 @@ def check_max_dygraph_results(self, place):

self.assertTrue(np.allclose(result.numpy(), result_np))

max_pool1d_dg = paddle.nn.layer.MaxPool1d(
max_pool1d_dg = paddle.nn.layer.MaxPool1D(
kernel_size=2, stride=None, padding=0)
result = max_pool1d_dg(input)
self.assertTrue(np.allclose(result.numpy(), result_np))
Expand All @@ -200,14 +201,14 @@ def check_max_dygraph_return_index_results(self, place):
input_np = np.random.random([2, 3, 32]).astype("float32")
input = fluid.dygraph.to_variable(input_np)
result, index = F.max_pool1d(
input, kernel_size=2, stride=2, padding=0, return_indices=True)
input, kernel_size=2, stride=2, padding=0, return_mask=True)

result_np = max_pool1D_forward_naive(
input_np, ksize=[2], strides=[2], paddings=[0])

self.assertTrue(np.allclose(result.numpy(), result_np))

max_pool1d_dg = paddle.nn.layer.MaxPool1d(
max_pool1d_dg = paddle.nn.layer.MaxPool1D(
kernel_size=2, stride=None, padding=0)
result = max_pool1d_dg(input)
self.assertTrue(np.allclose(result.numpy(), result_np))
Expand Down Expand Up @@ -248,7 +249,7 @@ def test_pool1d(self):
self.check_max_dygraph_return_index_results(place)


class TestPool2dError_API(unittest.TestCase):
class TestPool2DError_API(unittest.TestCase):
def test_error_api(self):
def run1():
with fluid.dygraph.guard():
Expand Down
10 changes: 5 additions & 5 deletions python/paddle/fluid/tests/unittests/test_pool2d_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def check_max_dygraph_results(self, place):
input_np = np.random.random([2, 3, 32, 32]).astype("float32")
input = fluid.dygraph.to_variable(input_np)
result = max_pool2d(
input, kernel_size=2, stride=2, padding=0, return_indices=False)
input, kernel_size=2, stride=2, padding=0, return_mask=False)

result_np = pool2D_forward_naive(
input_np,
Expand All @@ -159,7 +159,7 @@ def check_max_dygraph_nhwc_results(self, place):
kernel_size=2,
stride=2,
padding=0,
return_indices=False,
return_mask=False,
data_format="NHWC")

result_np = pool2D_forward_naive(
Expand Down Expand Up @@ -222,7 +222,7 @@ def check_max_dygraph_stride_is_none(self, place):
kernel_size=2,
stride=None,
padding="SAME",
return_indices=True)
return_mask=True)

result_np = pool2D_forward_naive(
input_np,
Expand Down Expand Up @@ -269,7 +269,7 @@ def check_max_dygraph_padding(self, place):
kernel_size=2,
stride=2,
padding=padding,
return_indices=False)
return_mask=False)

result_np = pool2D_forward_naive(
input_np,
Expand Down Expand Up @@ -490,7 +490,7 @@ def run9():
padding=0,
ceil_mode=False,
data_format='NHWC',
return_indices=True)
return_mask=True)

self.assertRaises(ValueError, run9)

Expand Down
10 changes: 5 additions & 5 deletions python/paddle/fluid/tests/unittests/test_pool3d_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def check_avg_dygraph_padding_results(self, place):
stride=2,
padding=1,
ceil_mode=False,
count_include_pad=True)
exclusive=True)

result_np = avg_pool3D_forward_naive(
input_np,
Expand All @@ -100,7 +100,7 @@ def check_avg_dygraph_padding_results(self, place):
stride=None,
padding=1,
ceil_mode=False,
count_include_pad=True)
exclusive=True)
result = avg_pool3d_dg(input)
self.assertTrue(np.allclose(result.numpy(), result_np))

Expand Down Expand Up @@ -175,7 +175,7 @@ def check_max_dygraph_ndhwc_results(self, place):
stride=2,
padding=0,
data_format="NDHWC",
return_indices=False)
return_mask=False)

result_np = pool3D_forward_naive(
input_np,
Expand Down Expand Up @@ -239,7 +239,7 @@ def check_max_dygraph_stride_is_none(self, place):
kernel_size=2,
stride=None,
padding="SAME",
return_indices=True)
return_mask=True)

result_np = pool3D_forward_naive(
input_np,
Expand Down Expand Up @@ -467,7 +467,7 @@ def run10():
stride=2,
padding=0,
data_format='NDHWC',
return_indices=True)
return_mask=True)

self.assertRaises(ValueError, run10)

Expand Down
Loading