From e871367027bc1009c65943dc0f88b6923308eb33 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Thu, 22 Aug 2024 14:44:01 +0900 Subject: [PATCH] [compute/cker] Add big integer mul test (#13739) This commit add big integer mul cker unittest. ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh --- compute/cker/src/Mul.test.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/compute/cker/src/Mul.test.cc b/compute/cker/src/Mul.test.cc index eee73fd89ca..922bbce35bc 100644 --- a/compute/cker/src/Mul.test.cc +++ b/compute/cker/src/Mul.test.cc @@ -208,6 +208,28 @@ TEST(CKer_Operation, Mul) EXPECT_EQ(output[i], expected_output[i]); } + // Int64 big value + { + // Shape: {1, 2, 2, 1} + std::vector input1 = {INT32_MIN, INT32_MIN, INT32_MAX, 3}; + // Shape: {1, 2, 2, 1} + std::vector input2 = {INT32_MAX, INT32_MIN, INT32_MAX, 4}; + std::vector expected_output = {INT64_MIN / 2 + INT32_MAX + 1, INT64_MAX / 2 + 1, + INT64_MAX / 2 + INT32_MIN + INT32_MIN + 2, 12}; + std::vector output(4); + + nnfw::cker::BinaryArithmeticOpParam param; + param.int64_activation_min = std::numeric_limits::lowest(); + param.int64_activation_max = std::numeric_limits::max(); + nnfw::cker::Shape shape{1, 2, 2, 1}; + + nnfw::cker::BinaryArithmeticOp( + param, shape, input1.data(), shape, input2.data(), shape, output.data()); + + for (size_t i = 0; i < expected_output.size(); ++i) + EXPECT_EQ(output[i], expected_output[i]); + } + // Int64 Relu { // Shape: {1, 2, 2, 1}