[C++ API] Added missing antialiasing path in interpolation C++ api (#84599)

Description:

Following https://github.com/pytorch/pytorch/pull/69318#issuecomment-1238433540 adding missing bicubic path for anti-alias flag to C++ frontend.

- https://github.com/pytorch/pytorch/pull/70930

- added tests in pytorch/test/cpp/api/functional.cpp

Pull Request resolved: https://github.com/pytorch/pytorch/pull/84599
Approved by: https://github.com/kit1980, https://github.com/malfet
This commit is contained in:
vfdev-5
2022-09-13 03:54:07 +00:00
committed by PyTorch MergeBot
parent 2fbc0fab20
commit d951165bd8
2 changed files with 28 additions and 2 deletions
+14
View File
@@ -2252,6 +2252,20 @@ TEST_F(FunctionalTest, Interpolate) {
auto output = F::interpolate(tensor, options);
ASSERT_TRUE(output.allclose(expected));
}
{
auto tensor = torch::rand({2, 3, 32, 32});
std::vector<int64_t> osize = {8, 10};
auto expected = at::native::_upsample_bicubic2d_aa(
tensor, osize, false, torch::nullopt);
auto options = F::InterpolateFuncOptions()
.size(osize)
.mode(torch::kBicubic)
.align_corners(false)
.antialias(true);
auto output = F::interpolate(tensor, options);
ASSERT_TRUE(output.allclose(expected));
}
}
TEST_F(FunctionalTest, Pad1) {