MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / check_chanwise

Function check_chanwise

dnn/test/cuda/chanwise_convolution.cpp:439–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

437
438template <typename Op>
439void check_chanwise(DType io_type, DType comp_type, Handle* handle, const char* name) {
440 Checker<Op> checker(handle);
441 bool require_algo = false;
442 checker.set_before_exec_callback(AlgoCheckerMaker<Op>::make(name, &require_algo));
443 checker.set_dtype(0, io_type).set_dtype(1, io_type).set_dtype(2, io_type);
444 bool io16xc32 = false;
445 if (io_type == dtype::Float16()) {
446 if (comp_type == dtype::Float16()) {
447 checker.set_epsilon(1e-1);
448 } else {
449 io16xc32 = true;
450 }
451 }
452 // dispatch testcase by operation
453 if (std::is_same<Op, ConvolutionForward>::value) {
454 // align 8
455 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
456 .execs({{8, 2, 16, 16}, {2, 1, 1, 15, 15}, {}});
457 // align 1
458 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
459 .execs({{8, 2, 15, 15}, {2, 1, 1, 15, 15}, {}});
460 // align 2
461 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
462 .execs({{8, 2, 14, 14}, {2, 1, 1, 15, 15}, {}});
463 // custom padding
464 checker.set_param(gconv_param({M, 3, 3, 1, 1}, io16xc32))
465 .execs({{8, 2, 16, 16}, {2, 1, 1, 15, 15}, {}});
466 // custom stride
467 checker.set_param(gconv_param({M, 7, 7, 2, 2}, io16xc32))
468 .execs({{8, 2, 16, 16}, {2, 1, 1, 15, 15}, {}});
469 } else if (std::is_same<Op, ConvolutionBackwardData>::value) {
470 // align 8
471 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
472 .execs({{2, 1, 1, 15, 15}, {8, 2, 16, 16}, {8, 2, 16, 16}});
473 // align 1
474 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
475 .execs({{2, 1, 1, 15, 15}, {8, 2, 15, 15}, {8, 2, 15, 15}});
476 // align 2
477 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
478 .execs({{2, 1, 1, 15, 15}, {8, 2, 14, 14}, {8, 2, 14, 14}});
479 // custom padding
480 checker.set_param(gconv_param({M, 3, 3, 1, 1}, io16xc32))
481 .execs({{2, 1, 1, 15, 15}, {8, 2, 8, 8}, {8, 2, 16, 16}});
482 // custom stride
483 checker.set_param(gconv_param({M, 7, 7, 2, 2}, io16xc32))
484 .execs({{2, 1, 1, 15, 15}, {8, 2, 7, 7}, {8, 2, 14, 14}});
485 } else if (std::is_same<Op, ConvolutionBackwardFilter>::value) {
486 // align 8
487 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
488 .execs({{8, 2, 16, 16}, {8, 2, 16, 16}, {2, 1, 1, 15, 15}});
489 // align 1
490 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
491 .execs({{8, 2, 15, 15}, {8, 2, 15, 15}, {2, 1, 1, 15, 15}});
492 // align 2
493 checker.set_param(gconv_param({M, 7, 7, 1, 1}, io16xc32))
494 .execs({{8, 2, 14, 14}, {8, 2, 14, 14}, {2, 1, 1, 15, 15}});
495 // custom padding
496 checker.set_param(gconv_param({M, 3, 3, 1, 1}, io16xc32))

Callers

nothing calls this directly

Calls 4

set_dtypeMethod · 0.80
gconv_paramFunction · 0.70
makeFunction · 0.50
execsMethod · 0.45

Tested by

no test coverage detected