1 /*******************************************************************************
2 * Copyright 2019 Intel Corporation
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.
15 *******************************************************************************/
17 #include "mkldnn_test_common.hpp"
18 #include "gtest/gtest.h"
21 #include "test_binary_convolution_forward_common.hpp"
25 using binary_convolution_test = binary_convolution_forward_test;
27 TEST_P(binary_convolution_test, TestBinaryConvolutionEltwise)
33 #define DIRECTION_FORWARD
34 #include "convolution_common.h"
36 #define PARAMS_WITH_ELTIWSE(...) \
37 EXPAND_ARGS(PARAMS(eltwise_relu, __VA_ARGS__)), \
38 EXPAND_ARGS(PARAMS(eltwise_elu, __VA_ARGS__)), \
39 EXPAND_ARGS(PARAMS(eltwise_tanh, __VA_ARGS__)), \
40 EXPAND_ARGS(PARAMS(eltwise_square, __VA_ARGS__)), \
41 EXPAND_ARGS(PARAMS(eltwise_abs, __VA_ARGS__)), \
42 EXPAND_ARGS(PARAMS(eltwise_sqrt, __VA_ARGS__)), \
43 EXPAND_ARGS(PARAMS(eltwise_linear, __VA_ARGS__)), \
44 EXPAND_ARGS(PARAMS(eltwise_bounded_relu, __VA_ARGS__)), \
45 EXPAND_ARGS(PARAMS(eltwise_soft_relu, __VA_ARGS__)), \
46 EXPAND_ARGS(PARAMS(eltwise_logistic, __VA_ARGS__)), \
47 EXPAND_ARGS(PARAMS(eltwise_clamp, __VA_ARGS__))
49 INST_TEST_CASE(SimpleSmall_Blocked_Padded_Channels,
50 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
51 2, 1, 3, 10, 10, 3, 10, 10, 3, 3, 1, 1, 1, 1),
52 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
53 2, 1, 3, 10, 10, 32, 10, 10, 3, 3, 1, 1, 1, 1),
54 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
55 2, 1, 5, 10, 10, 137, 10, 10, 3, 3, 1, 1, 1, 1),
56 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
57 2, 1, 4, 10, 10, 256, 10, 10, 3, 3, 1, 1, 1, 1)
60 INST_TEST_CASE(SimpleSmall_Blocked_1x1_Padded_Channels,
61 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
62 2, 1, 3, 10, 10, 3, 10, 10, 1, 1, 0, 0, 1, 1),
63 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
64 2, 1, 13, 3, 3, 41, 3, 3, 1, 1, 0, 0, 1, 1),
65 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
66 2, 1, 15, 3, 3, 137, 3, 3, 1, 1, 0, 0, 1, 1),
67 PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED, FMT_BIAS, FMT_DATA_BLOCKED,
68 2, 1, 14, 3, 3, 256, 3, 3, 1, 1, 0, 0, 1, 1)
71 //INST_TEST_CASE(SimpleSmall_Depthwise_Blocked_Padded_Channels,
72 // PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED_G, FMT_BIAS, FMT_DATA_BLOCKED,
73 // 2, 32, 32, 10, 10, 32, 10, 10, 3, 3, 1, 1, 1, 1),
74 // PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED_G, FMT_BIAS, FMT_DATA_BLOCKED,
75 // 2, 43, 43, 10, 10, 43, 10, 10, 3, 3, 1, 1, 1, 1),
76 // PARAMS_WITH_ELTIWSE(FMT_DATA_BLOCKED, FMT_WEIGHTS_BLOCKED_G, FMT_BIAS, FMT_DATA_BLOCKED,
77 // 2, 256, 256, 10, 10, 256, 10, 10, 3, 3, 1, 1, 1, 1)