| 1270 | param::ConvBias::Format layout); |
| 1271 | |
| 1272 | std::vector<conv_bias::TestArg> get_conv_bias_args( |
| 1273 | std::vector<size_t> kernel, size_t stride, bool no_pad, bool no_bias, |
| 1274 | bool no_nonlinemode, bool quantized_nlmod, bool only_broadcast_bias) { |
| 1275 | using namespace conv_bias; |
| 1276 | using Param = param::ConvBias; |
| 1277 | using NLMode = param::ConvBias::NonlineMode; |
| 1278 | std::vector<TestArg> args; |
| 1279 | |
| 1280 | auto pack = [&](size_t n, size_t oc, size_t ic, size_t w, size_t h, size_t kernel, |
| 1281 | size_t stride, NLMode nlmode) { |
| 1282 | Param param; |
| 1283 | param.stride_h = stride; |
| 1284 | param.stride_w = stride; |
| 1285 | if (!no_pad) { |
| 1286 | param.pad_h = kernel / 2; |
| 1287 | param.pad_w = kernel / 2; |
| 1288 | } else { |
| 1289 | param.pad_h = 0; |
| 1290 | param.pad_w = 0; |
| 1291 | } |
| 1292 | param.nonlineMode = nlmode; |
| 1293 | |
| 1294 | args.emplace_back( |
| 1295 | param, TensorShape{n, ic, h, w}, TensorShape{oc, ic, kernel, kernel}, |
| 1296 | TensorShape{}); |
| 1297 | if (!no_bias) { |
| 1298 | args.emplace_back( |
| 1299 | param, TensorShape{n, ic, h, w}, |
| 1300 | TensorShape{oc, ic, kernel, kernel}, TensorShape{1, oc, 1, 1}); |
| 1301 | |
| 1302 | if (!only_broadcast_bias) { |
| 1303 | args.emplace_back( |
| 1304 | param, TensorShape{n, ic, h, w}, |
| 1305 | TensorShape{oc, ic, kernel, kernel}, |
| 1306 | TensorShape{ |
| 1307 | n, oc, (h + 2 * param.pad_h - kernel) / stride + 1, |
| 1308 | (w + 2 * param.pad_h - kernel) / stride + 1}); |
| 1309 | } |
| 1310 | } |
| 1311 | param.sparse = param::ConvBias::Sparse::GROUP; |
| 1312 | args.emplace_back( |
| 1313 | param, TensorShape{n, 2 * ic, h, w}, |
| 1314 | TensorShape{2, oc, ic, kernel, kernel}, TensorShape{}); |
| 1315 | if (!no_bias) { |
| 1316 | if (!only_broadcast_bias) { |
| 1317 | args.emplace_back( |
| 1318 | param, TensorShape{n, 2 * ic, h, w}, |
| 1319 | TensorShape{2, oc, ic, kernel, kernel}, |
| 1320 | TensorShape{ |
| 1321 | n, 2 * oc, (h + param.pad_h * 2 - kernel) / stride + 1, |
| 1322 | (w + param.pad_w * 2 - kernel) / stride + 1}); |
| 1323 | } |
| 1324 | args.emplace_back( |
| 1325 | param, TensorShape{n, 2 * ic, h, w}, |
| 1326 | TensorShape{2, oc, ic, kernel, kernel}, |
| 1327 | TensorShape{1, 2 * oc, 1, 1}); |
| 1328 | } |
| 1329 | }; |