From ae73737a279947324469161ee0cd08d802c3305d Mon Sep 17 00:00:00 2001 From: Manuel Candales Date: Thu, 4 Sep 2025 14:35:11 -0700 Subject: [PATCH] Add upsample_bilinar2d_aa correctness test and enable ATen mode Differential Revision: D81720498 --- .../test/op_upsample_bilinear2d_aa_test.cpp | 31 +++++++++++++++++++ kernels/test/targets.bzl | 2 +- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/kernels/test/op_upsample_bilinear2d_aa_test.cpp b/kernels/test/op_upsample_bilinear2d_aa_test.cpp index b6a9e6c5bdb..999ce705058 100644 --- a/kernels/test/op_upsample_bilinear2d_aa_test.cpp +++ b/kernels/test/op_upsample_bilinear2d_aa_test.cpp @@ -625,3 +625,34 @@ TEST_F(OpUpsampleBilinear2dAAOutTest, TestPrecisionConsistency) { EXPECT_EQ(out1_data[i], out2_data[i]); } } + +TEST_F(OpUpsampleBilinear2dAAOutTest, SmokeTestCorrectness) { + TensorFactory tf; + + Tensor input = tf.make( + {1, 1, 8, 1}, + {-98.5, 49.875, 17.125, -46.5, 10.625, -95.875, -3.875, -4.625}); + + int64_t output_size_data[2] = {3, 8}; + ArrayRef output_size(output_size_data, 2); + + Tensor out = tf.zeros({1, 1, 3, 8}); + + // clang-format off + Tensor expected = tf.make({1, 1, 3, 8}, { + -8.4408, -8.4408, -8.4408, -8.4408, -8.4408, -8.4408, -8.4408, -8.4408, + -23.1339, -23.1339, -23.1339, -23.1339, -23.1339, -23.1339, -23.1339, -23.1339, + -24.7368, -24.7368, -24.7368, -24.7368, -24.7368, -24.7368, -24.7368, -24.7368 + }); + // clang-format on + + op_upsample_bilinear2d_aa_out( + input, + output_size, + /*align_corners=*/false, + std::nullopt, + std::nullopt, + out); + + EXPECT_TENSOR_CLOSE(out, expected); +} diff --git a/kernels/test/targets.bzl b/kernels/test/targets.bzl index a4e681a7be1..48d501dfe35 100644 --- a/kernels/test/targets.bzl +++ b/kernels/test/targets.bzl @@ -335,7 +335,7 @@ def define_common_targets(): _common_op_test("op_unfold_copy_test", ["aten", "portable"]) _common_op_test("op_unsqueeze_copy_test", ["aten", "portable"]) _common_op_test("op_upsample_bilinear2d_test", ["aten", "portable"]) - _common_op_test("op_upsample_bilinear2d_aa_test", ["portable"]) + _common_op_test("op_upsample_bilinear2d_aa_test", ["aten", "portable"]) _common_op_test("op_upsample_nearest2d_test", ["aten", "portable"]) _common_op_test("op_var_test", ["aten", "portable"]) _common_op_test("op_view_as_real_copy_test", ["aten", "portable"])