Skip to content
Draft
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
31 changes: 31 additions & 0 deletions kernels/test/op_upsample_bilinear2d_aa_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,3 +625,34 @@ TEST_F(OpUpsampleBilinear2dAAOutTest, TestPrecisionConsistency) {
EXPECT_EQ(out1_data[i], out2_data[i]);
}
}

TEST_F(OpUpsampleBilinear2dAAOutTest, SmokeTestCorrectness) {
TensorFactory<ScalarType::Float> 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<int64_t> 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);
}
2 changes: 1 addition & 1 deletion kernels/test/targets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Loading