Skip to content

Commit

Permalink
[compute/cker] Add big integer mul test (#13739)
Browse files Browse the repository at this point in the history
This commit add big integer mul cker unittest.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Aug 22, 2024
1 parent 10939b7 commit e871367
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions compute/cker/src/Mul.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<int64_t> input1 = {INT32_MIN, INT32_MIN, INT32_MAX, 3};
// Shape: {1, 2, 2, 1}
std::vector<int64_t> input2 = {INT32_MAX, INT32_MIN, INT32_MAX, 4};
std::vector<int64_t> expected_output = {INT64_MIN / 2 + INT32_MAX + 1, INT64_MAX / 2 + 1,
INT64_MAX / 2 + INT32_MIN + INT32_MIN + 2, 12};
std::vector<int64_t> output(4);

nnfw::cker::BinaryArithmeticOpParam param;
param.int64_activation_min = std::numeric_limits<int64_t>::lowest();
param.int64_activation_max = std::numeric_limits<int64_t>::max();
nnfw::cker::Shape shape{1, 2, 2, 1};

nnfw::cker::BinaryArithmeticOp<nnfw::cker::BinaryArithmeticOpType::MUL>(
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}
Expand Down

0 comments on commit e871367

Please sign in to comment.