mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
bug fix FractionalMaxPool2d (random_samples dimensions) (#70031)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/70031 Test Plan: Imported from OSS Reviewed By: ejguan Differential Revision: D33200618 Pulled By: george-qi fbshipit-source-id: 142f224c2cab1008d2d4e9ed333697a92d2d42db
This commit is contained in:
committed by
Facebook GitHub Bot
parent
91da2d5fa1
commit
bb51519937
@@ -173,6 +173,27 @@ TEST_F(FunctionalTest, FractionalMaxPool2d) {
|
||||
{{ 0, 2},
|
||||
{10, 12}}})));
|
||||
ASSERT_EQ(std::get<1>(y_with_indices).sizes(), std::vector<int64_t>({2, 2, 2}));
|
||||
|
||||
auto x1 = torch::ones({2, 2, 5, 5});
|
||||
auto y1 = F::fractional_max_pool2d(x1, F::FractionalMaxPool2dFuncOptions(3).output_size(2));
|
||||
|
||||
ASSERT_EQ(y1.ndimension(), 4);
|
||||
ASSERT_TRUE(torch::allclose(y1, torch::ones({2, 2, 2, 2})));
|
||||
ASSERT_EQ(y1.sizes(), std::vector<int64_t>({2, 2, 2, 2}));
|
||||
|
||||
auto y1_with_indices = F::fractional_max_pool2d_with_indices(x1, F::FractionalMaxPool2dFuncOptions(3).output_size(2));
|
||||
ASSERT_TRUE(torch::equal(y1, std::get<0>(y1_with_indices)));
|
||||
ASSERT_TRUE(torch::allclose(
|
||||
std::get<1>(y1_with_indices),
|
||||
torch::tensor({{{{ 0, 2},
|
||||
{10, 12}},
|
||||
{{ 0, 2},
|
||||
{10, 12}}},
|
||||
{{{ 0, 2},
|
||||
{10, 12}},
|
||||
{{ 0, 2},
|
||||
{10, 12}}}})));
|
||||
ASSERT_EQ(std::get<1>(y1_with_indices).sizes(), std::vector<int64_t>({2, 2, 2, 2}));
|
||||
}
|
||||
|
||||
TEST_F(FunctionalTest, FractionalMaxPool3d) {
|
||||
|
||||
Reference in New Issue
Block a user