Skip to content

Commit

Permalink
Add negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
ragmani committed Aug 21, 2024
1 parent c1225bd commit ad2449a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions compiler/luci-interpreter/src/kernels/InstanceNorm.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,38 @@ TEST_F(InstanceNormTest, Wrong_gamma_beta_dim_NEG)
EXPECT_ANY_THROW(kernel.configure());
}

TEST_F(InstanceNormTest, Wrong_gamma_beta_dim_3D_NEG)
{
Tensor input_tensor =
makeInputTensor<DataType::FLOAT32>({1, 2, 2}, {1, 1, 1, 1}, _memory_manager.get());
Tensor gamma_tensor = makeInputTensor<DataType::FLOAT32>({3}, {1, 1, 1}, _memory_manager.get());
Tensor beta_tensor = makeInputTensor<DataType::FLOAT32>({3}, {2, 2, 2}, _memory_manager.get());
Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);

InstanceNormParams params{};
params.epsilon = 0.1f;
params.activation = Activation::NONE;

InstanceNorm kernel(&input_tensor, &gamma_tensor, &beta_tensor, &output_tensor, params);
EXPECT_ANY_THROW(kernel.configure());
}

TEST_F(InstanceNormTest, Unsupported_dims_NEG)
{
Tensor input_tensor =
makeInputTensor<DataType::FLOAT32>({2, 2}, {1, 1, 1, 1}, _memory_manager.get());
Tensor gamma_tensor = makeInputTensor<DataType::FLOAT32>({2}, {1, 1}, _memory_manager.get());
Tensor beta_tensor = makeInputTensor<DataType::FLOAT32>({2}, {2, 2}, _memory_manager.get());
Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);

InstanceNormParams params{};
params.epsilon = 0.1f;
params.activation = Activation::NONE;

InstanceNorm kernel(&input_tensor, &gamma_tensor, &beta_tensor, &output_tensor, params);
EXPECT_ANY_THROW(kernel.configure());
}

} // namespace
} // namespace kernels
} // namespace luci_interpreter

0 comments on commit ad2449a

Please sign in to comment.