Imported Upstream version 1.18.0
[platform/core/ml/nnfw.git] / compiler / luci-interpreter / src / kernels / DepthwiseConv2D.test.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
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
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #include "kernels/DepthwiseConv2D.h"
18 #include "kernels/TestUtils.h"
19 #include "luci_interpreter/TestMemoryManager.h"
20
21 namespace luci_interpreter
22 {
23 namespace kernels
24 {
25 namespace
26 {
27
28 using namespace testing;
29
30 class DepthwiseConv2DTest : public ::testing::Test
31 {
32 protected:
33   void SetUp() override { _memory_manager = std::make_unique<TestMemoryManager>(); }
34
35   std::unique_ptr<IMemoryManager> _memory_manager;
36 };
37
38 TEST_F(DepthwiseConv2DTest, Float)
39 {
40   Shape input_shape{1, 4, 2, 2};
41   Shape filter_shape{1, 2, 2, 4};
42   Shape bias_shape{4};
43   std::vector<float> input_data{
44     1,  2,  7,  8,  //
45     3,  4,  9,  10, //
46     5,  6,  11, 12, //
47     13, 14, 15, 16, //
48   };
49   std::vector<float> filter_data{
50     1,  2,   3,   4,   //
51     -9, 10,  -11, 12,  //
52     5,  6,   7,   8,   //
53     13, -14, 15,  -16, //
54   };
55   std::vector<float> bias_data{1, 2, 3, 4};
56   Tensor input_tensor =
57     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
58   Tensor filter_tensor =
59     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
60   Tensor bias_tensor =
61     makeInputTensor<DataType::FLOAT32>(bias_shape, bias_data, _memory_manager.get());
62   Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
63
64   DepthwiseConv2DParams params{};
65   params.padding = Padding::VALID;
66   params.depth_multiplier = 2;
67   params.stride_height = 2;
68   params.stride_width = 1;
69   params.dilation_height_factor = 1;
70   params.dilation_width_factor = 1;
71   params.activation = Activation::RELU;
72
73   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
74   kernel.configure();
75   _memory_manager->allocate_memory(output_tensor);
76   kernel.execute();
77
78   std::vector<float> ref_output_data{
79     71,  0, 99,  0,  //
80     167, 0, 227, 28, //
81   };
82   EXPECT_THAT(extractTensorData<float>(output_tensor), FloatArrayNear(ref_output_data));
83   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray({1, 2, 1, 4}));
84 }
85
86 TEST_F(DepthwiseConv2DTest, Uint8)
87 {
88   std::vector<float> input_data{
89     1, 2, 7,  8,  // column 1
90     3, 4, 9,  10, // column 2
91     5, 6, 11, 12, // column 3
92   };
93   std::vector<float> filter_data{
94     1,  2,   3,   4,   //
95     -9, 10,  -11, 12,  //
96     5,  6,   7,   8,   //
97     13, -14, 15,  -16, //
98   };
99   std::vector<float> bias_data{1, 2, 3, 4};
100
101   std::pair<float, int32_t> input_quant_param = quantizationParams<uint8_t>(-63.5, 64);
102   std::pair<float, int32_t> output_quant_param = quantizationParams<uint8_t>(-127, 128);
103
104   Tensor input_tensor =
105     makeInputTensor<DataType::U8>({1, 3, 2, 2}, input_quant_param.first, input_quant_param.second,
106                                   input_data, _memory_manager.get());
107   Tensor filter_tensor =
108     makeInputTensor<DataType::U8>({1, 2, 2, 4}, input_quant_param.first, input_quant_param.second,
109                                   filter_data, _memory_manager.get());
110   Tensor bias_tensor = makeInputTensor<DataType::S32>(
111     {4}, input_quant_param.first * input_quant_param.first, 0, bias_data, _memory_manager.get());
112   Tensor output_tensor =
113     makeOutputTensor(DataType::U8, output_quant_param.first, output_quant_param.second);
114
115   DepthwiseConv2DParams params{};
116   params.padding = Padding::VALID;
117   params.depth_multiplier = 2;
118   params.stride_height = 1;
119   params.stride_width = 1;
120   params.dilation_height_factor = 1;
121   params.dilation_width_factor = 1;
122   params.activation = Activation::NONE;
123
124   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
125   kernel.configure();
126   _memory_manager->allocate_memory(output_tensor);
127   kernel.execute();
128
129   std::vector<float> ref_output_data{
130     71, -34, 99,  -20, //
131     91, -26, 127, -4,  //
132   };
133   EXPECT_THAT(dequantizeTensorData(output_tensor), FloatArrayNear(ref_output_data));
134   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray({1, 2, 1, 4}));
135 }
136
137 TEST_F(DepthwiseConv2DTest, SInt16)
138 {
139   Shape input_shape{1, 4, 2, 2};
140   Shape filter_shape{1, 2, 2, 4};
141   Shape bias_shape{4};
142   std::vector<int32_t> ref_output_shape{1, 2, 1, 4};
143
144   std::vector<float> input_data{
145     1,  2,  7,  8,  //
146     3,  4,  9,  10, //
147     5,  6,  11, 12, //
148     13, 14, 15, 16, //
149   };
150   std::vector<float> filter_data{
151     1,  2,   3,   4,   //
152     -9, 10,  -11, 12,  //
153     5,  6,   7,   8,   //
154     13, -14, 15,  -16, //
155   };
156   std::vector<float> bias_data{1, 2, 3, 4};
157   std::vector<float> ref_output_data{
158     71,  0, 99,  0,  //
159     167, 0, 227, 28, //
160   };
161
162   Tensor input_tensor =
163     makeInputTensor<DataType::S16>(input_shape, 0.25, 0, input_data, _memory_manager.get());
164   Tensor filter_tensor =
165     makeInputTensor<DataType::S16>(filter_shape, 0.2, 0, filter_data, _memory_manager.get());
166   Tensor bias_tensor =
167     makeInputTensor<DataType::S64>(bias_shape, 0.25 * 0.2, 0, bias_data, _memory_manager.get());
168   Tensor output_tensor = makeOutputTensor(DataType::S16, 0.5, 0);
169
170   DepthwiseConv2DParams params{};
171   params.padding = Padding::VALID;
172   params.depth_multiplier = 2;
173   params.stride_height = 2;
174   params.stride_width = 1;
175   params.dilation_height_factor = 1;
176   params.dilation_width_factor = 1;
177   params.activation = Activation::RELU;
178
179   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
180   kernel.configure();
181   _memory_manager->allocate_memory(output_tensor);
182   kernel.execute();
183
184   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray(ref_output_shape));
185   EXPECT_THAT(dequantizeTensorData(output_tensor), FloatArrayNear(ref_output_data));
186 }
187
188 TEST_F(DepthwiseConv2DTest, SInt16_CWQ_weights)
189 {
190   const int output_channels = 4;
191   Shape input_shape{1, 4, 2, 2};
192   Shape filter_shape{1, 2, 2, output_channels};
193   Shape bias_shape{4};
194   std::vector<int32_t> ref_output_shape{1, 2, 1, output_channels};
195
196   std::vector<float> input_data{
197     1,  2,  7,  8,  //
198     3,  4,  9,  10, //
199     5,  6,  11, 12, //
200     13, 14, 15, 16, //
201   };
202   std::vector<float> filter_data{
203     1,  2,   3,   4,   //
204     -9, 10,  -11, 12,  //
205     5,  6,   7,   8,   //
206     13, -14, 15,  -16, //
207   };
208   std::vector<float> bias_data{1, 2, 3, 4};
209   std::vector<float> ref_output_data{
210     71,  0, 99,  0,  //
211     167, 0, 227, 28, //
212   };
213
214   float input_scale = 0.25;
215   std::vector<float> filter_scales{0.2f, 1.f, 0.5f, 0.1f};
216   std::vector<float> bias_scales;
217   for (int i = 0; i < output_channels; ++i)
218     bias_scales.push_back(filter_scales[i] * input_scale);
219   std::vector<int32_t> zerop(4, 0);
220   Tensor input_tensor =
221     makeInputTensor<DataType::S16>(input_shape, input_scale, 0, input_data, _memory_manager.get());
222   Tensor filter_tensor = makeInputTensor<DataType::S16>(filter_shape, filter_scales, zerop, 3,
223                                                         filter_data, _memory_manager.get());
224   Tensor bias_tensor = makeInputTensor<DataType::S64>(bias_shape, bias_scales, zerop, 0, bias_data,
225                                                       _memory_manager.get());
226   Tensor output_tensor = makeOutputTensor(DataType::S16, 0.5, 0);
227
228   DepthwiseConv2DParams params{};
229   params.padding = Padding::VALID;
230   params.depth_multiplier = 2;
231   params.stride_height = 2;
232   params.stride_width = 1;
233   params.dilation_height_factor = 1;
234   params.dilation_width_factor = 1;
235   params.activation = Activation::RELU;
236
237   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
238   kernel.configure();
239   _memory_manager->allocate_memory(output_tensor);
240   kernel.execute();
241
242   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray(ref_output_shape));
243   EXPECT_THAT(dequantizeTensorData(output_tensor), FloatArrayNear(ref_output_data));
244 }
245
246 TEST_F(DepthwiseConv2DTest, Uint8_CWQ_weights)
247 {
248   const int output_channels = 4;
249   Shape input_shape{1, 3, 2, 2};
250   Shape filter_shape{1, 2, 2, output_channels};
251   Shape bias_shape{4};
252   std::vector<int32_t> ref_output_shape{1, 2, 1, output_channels};
253
254   std::vector<float> input_data{
255     1, 2, 7,  8,  //
256     3, 4, 9,  10, //
257     5, 6, 11, 12, //
258   };
259   std::vector<float> filter_data{
260     1,  2,   3,   4,   //
261     -9, 10,  -11, 12,  //
262     5,  6,   7,   8,   //
263     13, -14, 15,  -16, //
264   };
265   std::vector<float> bias_data{1, 2, 3, 4};
266   std::vector<float> ref_output_data{
267     71, -34, 99,  -20, //
268     91, -26, 127, -4,  //
269   };
270
271   std::pair<float, int32_t> input_quant_param = quantizationParams<uint8_t>(0, 16);
272   std::pair<float, int32_t> output_quant_param = quantizationParams<uint8_t>(-127, 128);
273
274   std::vector<std::pair<float, int32_t>> filter_quant_params;
275   filter_quant_params.push_back(quantizationParams<uint8_t>(-9, 13));
276   filter_quant_params.push_back(quantizationParams<uint8_t>(-14, 10));
277   filter_quant_params.push_back(quantizationParams<uint8_t>(-11, 15));
278   filter_quant_params.push_back(quantizationParams<uint8_t>(-16, 12));
279
280   std::vector<float> filter_scales;
281   std::vector<int32_t> filter_zerops;
282   for (auto iter : filter_quant_params)
283   {
284     filter_scales.push_back(iter.first);
285     filter_zerops.push_back(iter.second);
286   }
287
288   std::vector<float> bias_scales;
289   for (int i = 0; i < output_channels; ++i)
290     bias_scales.push_back(filter_quant_params[i].first * input_quant_param.first);
291   std::vector<int32_t> zerop(output_channels, 0);
292
293   Tensor input_tensor =
294     makeInputTensor<DataType::U8>(input_shape, input_quant_param.first, input_quant_param.second,
295                                   input_data, _memory_manager.get());
296   Tensor filter_tensor = makeInputTensor<DataType::U8>(filter_shape, filter_scales, filter_zerops,
297                                                        3, filter_data, _memory_manager.get());
298   Tensor bias_tensor = makeInputTensor<DataType::S32>(bias_shape, bias_scales, zerop, 0, bias_data,
299                                                       _memory_manager.get());
300   Tensor output_tensor =
301     makeOutputTensor(DataType::U8, output_quant_param.first, output_quant_param.second);
302
303   DepthwiseConv2DParams params{};
304   params.padding = Padding::VALID;
305   params.depth_multiplier = 2;
306   params.stride_height = 1;
307   params.stride_width = 1;
308   params.dilation_height_factor = 1;
309   params.dilation_width_factor = 1;
310   params.activation = Activation::NONE;
311
312   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
313   kernel.configure();
314   _memory_manager->allocate_memory(output_tensor);
315   kernel.execute();
316
317   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray(ref_output_shape));
318   EXPECT_THAT(dequantizeTensorData(output_tensor),
319               FloatArrayNear(ref_output_data, output_quant_param.first));
320 }
321
322 TEST_F(DepthwiseConv2DTest, SInt8_CWQ_weights)
323 {
324   const int output_channels = 4;
325   Shape input_shape{1, 3, 2, 2};
326   Shape filter_shape{1, 2, 2, output_channels};
327   Shape bias_shape{4};
328   std::vector<int32_t> ref_output_shape{1, 2, 1, output_channels};
329
330   std::vector<float> input_data{
331     1, 2, 7,  8,  //
332     3, 4, 9,  10, //
333     5, 6, 11, 12, //
334   };
335   std::vector<float> filter_data{
336     1,  2,   3,   4,   //
337     -9, 10,  -11, 12,  //
338     5,  6,   7,   8,   //
339     13, -14, 15,  -16, //
340   };
341   std::vector<float> bias_data{1, 2, 3, 4};
342   std::vector<float> ref_output_data{
343     71, -34, 99,  -20, //
344     91, -26, 127, -4,  //
345   };
346
347   std::pair<float, int32_t> input_quant_param = quantizationParams<int8_t>(-128, 127);
348   std::pair<float, int32_t> output_quant_param = quantizationParams<int8_t>(-127, 128);
349
350   std::vector<std::pair<float, int32_t>> filter_quant_params;
351   filter_quant_params.push_back(std::pair<float, int32_t>(0.5, 0));
352   filter_quant_params.push_back(std::pair<float, int32_t>(0.25, 0));
353   filter_quant_params.push_back(std::pair<float, int32_t>(1, 0));
354   filter_quant_params.push_back(std::pair<float, int32_t>(0.125, 0));
355
356   std::vector<float> filter_scales;
357   std::vector<int32_t> filter_zerops;
358   for (auto iter : filter_quant_params)
359   {
360     filter_scales.push_back(iter.first);
361     filter_zerops.push_back(iter.second);
362   }
363
364   std::vector<float> bias_scales;
365   for (int i = 0; i < output_channels; ++i)
366     bias_scales.push_back(filter_quant_params[i].first * input_quant_param.first);
367   std::vector<int32_t> zerop(output_channels, 0);
368
369   Tensor input_tensor =
370     makeInputTensor<DataType::S8>(input_shape, input_quant_param.first, input_quant_param.second,
371                                   input_data, _memory_manager.get());
372   Tensor filter_tensor = makeInputTensor<DataType::S8>(filter_shape, filter_scales, filter_zerops,
373                                                        3, filter_data, _memory_manager.get());
374   Tensor bias_tensor = makeInputTensor<DataType::S32>(bias_shape, bias_scales, zerop, 0, bias_data,
375                                                       _memory_manager.get());
376   Tensor output_tensor =
377     makeOutputTensor(DataType::S8, output_quant_param.first, output_quant_param.second);
378
379   DepthwiseConv2DParams params{};
380   params.padding = Padding::VALID;
381   params.depth_multiplier = 2;
382   params.stride_height = 1;
383   params.stride_width = 1;
384   params.dilation_height_factor = 1;
385   params.dilation_width_factor = 1;
386   params.activation = Activation::NONE;
387
388   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
389   kernel.configure();
390   _memory_manager->allocate_memory(output_tensor);
391   kernel.execute();
392
393   EXPECT_THAT(extractTensorShape(output_tensor), ::testing::ElementsAreArray(ref_output_shape));
394   EXPECT_THAT(dequantizeTensorData(output_tensor),
395               FloatArrayNear(ref_output_data, output_quant_param.first));
396 }
397
398 TEST_F(DepthwiseConv2DTest, InvalidBiasType_NEG)
399 {
400   Shape input_shape{1, 4, 2, 2};
401   Shape filter_shape{1, 2, 2, 4};
402   Shape bias_shape{4};
403   std::vector<float> input_data{
404     1,  2,  7,  8,  //
405     3,  4,  9,  10, //
406     5,  6,  11, 12, //
407     13, 14, 15, 16, //
408   };
409   std::vector<float> filter_data{
410     1,  2,   3,   4,   //
411     -9, 10,  -11, 12,  //
412     5,  6,   7,   8,   //
413     13, -14, 15,  -16, //
414   };
415   std::vector<int32_t> bias_data{1, 2, 3, 4};
416   Tensor input_tensor =
417     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
418   Tensor filter_tensor =
419     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
420   Tensor bias_tensor = makeInputTensor<DataType::S32>(bias_shape, bias_data, _memory_manager.get());
421   Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
422
423   DepthwiseConv2DParams params{};
424   params.padding = Padding::VALID;
425   params.depth_multiplier = 2;
426   params.stride_height = 2;
427   params.stride_width = 1;
428   params.dilation_height_factor = 1;
429   params.dilation_width_factor = 1;
430   params.activation = Activation::RELU;
431
432   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
433   EXPECT_ANY_THROW(kernel.configure());
434 }
435
436 TEST_F(DepthwiseConv2DTest, InOutTypeMismatch_NEG)
437 {
438   Shape input_shape{1, 4, 2, 2};
439   Shape filter_shape{1, 2, 2, 4};
440   Shape bias_shape{4};
441   std::vector<float> input_data{
442     1,  2,  7,  8,  //
443     3,  4,  9,  10, //
444     5,  6,  11, 12, //
445     13, 14, 15, 16, //
446   };
447   std::vector<float> filter_data{
448     1,  2,   3,   4,   //
449     -9, 10,  -11, 12,  //
450     5,  6,   7,   8,   //
451     13, -14, 15,  -16, //
452   };
453   std::vector<float> bias_data{1, 2, 3, 4};
454   Tensor input_tensor =
455     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
456   Tensor filter_tensor =
457     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
458   Tensor bias_tensor =
459     makeInputTensor<DataType::FLOAT32>(bias_shape, bias_data, _memory_manager.get());
460   Tensor output_tensor = makeOutputTensor(DataType::U8);
461
462   DepthwiseConv2DParams params{};
463   params.padding = Padding::VALID;
464   params.depth_multiplier = 2;
465   params.stride_height = 2;
466   params.stride_width = 1;
467   params.dilation_height_factor = 1;
468   params.dilation_width_factor = 1;
469   params.activation = Activation::RELU;
470
471   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
472   EXPECT_ANY_THROW(kernel.configure());
473 }
474
475 TEST_F(DepthwiseConv2DTest, InvalidInputShape_NEG)
476 {
477   Shape input_shape{4, 2, 2};
478   Shape filter_shape{2, 2, 4};
479   Shape bias_shape{4};
480   std::vector<float> input_data{
481     1,  2,  7,  8,  //
482     3,  4,  9,  10, //
483     5,  6,  11, 12, //
484     13, 14, 15, 16, //
485   };
486   std::vector<float> filter_data{
487     1,  2,   3,   4,   //
488     -9, 10,  -11, 12,  //
489     5,  6,   7,   8,   //
490     13, -14, 15,  -16, //
491   };
492   std::vector<float> bias_data{1, 2, 3, 4};
493   Tensor input_tensor =
494     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
495   Tensor filter_tensor =
496     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
497   Tensor bias_tensor =
498     makeInputTensor<DataType::FLOAT32>(bias_shape, bias_data, _memory_manager.get());
499   Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
500
501   DepthwiseConv2DParams params{};
502   params.padding = Padding::VALID;
503   params.depth_multiplier = 2;
504   params.stride_height = 2;
505   params.stride_width = 1;
506   params.dilation_height_factor = 1;
507   params.dilation_width_factor = 1;
508   params.activation = Activation::RELU;
509
510   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
511   EXPECT_ANY_THROW(kernel.configure());
512 }
513
514 TEST_F(DepthwiseConv2DTest, InvalidFilterShape_NEG)
515 {
516   Shape input_shape{1, 4, 2, 2};
517   Shape filter_shape{2, 1, 2, 4};
518   Shape bias_shape{4};
519   std::vector<float> input_data{
520     1,  2,  7,  8,  //
521     3,  4,  9,  10, //
522     5,  6,  11, 12, //
523     13, 14, 15, 16, //
524   };
525   std::vector<float> filter_data{
526     1,  2,   3,   4,   //
527     -9, 10,  -11, 12,  //
528     5,  6,   7,   8,   //
529     13, -14, 15,  -16, //
530   };
531   std::vector<float> bias_data{1, 2, 3, 4};
532   Tensor input_tensor =
533     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
534   Tensor filter_tensor =
535     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
536   Tensor bias_tensor =
537     makeInputTensor<DataType::FLOAT32>(bias_shape, bias_data, _memory_manager.get());
538   Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
539
540   DepthwiseConv2DParams params{};
541   params.padding = Padding::VALID;
542   params.depth_multiplier = 2;
543   params.stride_height = 2;
544   params.stride_width = 1;
545   params.dilation_height_factor = 1;
546   params.dilation_width_factor = 1;
547   params.activation = Activation::RELU;
548
549   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
550   EXPECT_ANY_THROW(kernel.configure());
551 }
552
553 TEST_F(DepthwiseConv2DTest, InvalidBiasDim_NEG)
554 {
555   Shape input_shape{1, 4, 2, 2};
556   Shape filter_shape{1, 2, 4, 2};
557   Shape bias_shape{4};
558   std::vector<float> input_data{
559     1,  2,  7,  8,  //
560     3,  4,  9,  10, //
561     5,  6,  11, 12, //
562     13, 14, 15, 16, //
563   };
564   std::vector<float> filter_data{
565     1,  2,   3,   4,   //
566     -9, 10,  -11, 12,  //
567     5,  6,   7,   8,   //
568     13, -14, 15,  -16, //
569   };
570   std::vector<float> bias_data{1, 2, 3, 4};
571   Tensor input_tensor =
572     makeInputTensor<DataType::FLOAT32>(input_shape, input_data, _memory_manager.get());
573   Tensor filter_tensor =
574     makeInputTensor<DataType::FLOAT32>(filter_shape, filter_data, _memory_manager.get());
575   Tensor bias_tensor =
576     makeInputTensor<DataType::FLOAT32>(bias_shape, bias_data, _memory_manager.get());
577   Tensor output_tensor = makeOutputTensor(DataType::FLOAT32);
578
579   DepthwiseConv2DParams params{};
580   params.padding = Padding::VALID;
581   params.depth_multiplier = 2;
582   params.stride_height = 2;
583   params.stride_width = 1;
584   params.dilation_height_factor = 1;
585   params.dilation_width_factor = 1;
586   params.activation = Activation::RELU;
587
588   DepthwiseConv2D kernel(&input_tensor, &filter_tensor, &bias_tensor, &output_tensor, params);
589   EXPECT_ANY_THROW(kernel.configure());
590 }
591
592 } // namespace
593 } // namespace kernels
594 } // namespace luci_interpreter