2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "kernels/Elu.h"
18 #include "kernels/TestUtils.h"
20 namespace luci_interpreter
27 using namespace testing;
29 void Check(std::initializer_list<int32_t> input_shape, std::initializer_list<int32_t> output_shape,
30 std::initializer_list<float> input_data, std::initializer_list<float> output_data)
32 Tensor input_tensor{DataType::FLOAT32, input_shape, {}, ""};
33 input_tensor.writeData(input_data.begin(), input_data.size() * sizeof(float));
35 Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
37 Elu kernel(&input_tensor, &output_tensor);
42 EXPECT_THAT(extractTensorData<float>(output_tensor),
43 ::testing::ElementsAreArray(ArrayFloatNear(output_data)));
46 TEST(EluTest, SimpleElu)
49 /*input_shape=*/{1, 2, 4, 1}, /*output_shape=*/{1, 2, 4, 1},
57 0.0, -0.997521, 2.0, -0.981684, //
58 3.0, -0.864665, 10.0, -0.0951626, //
63 } // namespace kernels
64 } // namespace luci_interpreter