Browse Source

fix(midout/naive/warp_perspective): fix Template Functions instantiation

GitOrigin-RevId: c487f3663d
release-0.6
Megvii Engine Team 5 years ago
parent
commit
845f42a38b
2 changed files with 28 additions and 5 deletions
  1. +10
    -5
      dnn/src/fallback/warp_perspective/opr_impl.cpp
  2. +18
    -0
      dnn/src/naive/warp_perspective/opr_impl.cpp

+ 10
- 5
dnn/src/fallback/warp_perspective/opr_impl.cpp View File

@@ -141,20 +141,25 @@ void WarpPerspectiveImpl::kern_fallback(
if (is_resize_optimizable(sub_param.mptr)) {
if (bmode == BorderMode::CONSTANT) {
MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(1),
midout_iv(true)) {
midout_iv(true), ctype, mtype) {
kern_resize<true, ctype, mtype>(sub_param);
} MIDOUT_END();
}
MIDOUT_END();
} else {
MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(1),
midout_iv(false)) {
midout_iv(false), ctype, mtype) {
kern_resize<false, ctype, mtype>(sub_param);
}
MIDOUT_END();
}
} else {
rep(oh, OH) kern_naive<ctype, mtype>(sub_param, oh);
MIDOUT_BEGIN(megdnn_fallback_warpperspective, midout_iv(2), ctype,
mtype) {
rep(oh, OH) kern_naive<ctype, mtype>(sub_param, oh);
}
MIDOUT_END();
}
sub_param.mptr += 3*3;
sub_param.mptr += 3 * 3;
sub_param.dptr += C*OH*OW;
}



+ 18
- 0
dnn/src/naive/warp_perspective/opr_impl.cpp View File

@@ -148,6 +148,24 @@ void WarpPerspectiveForwardImpl::kern_naive(
MIDOUT_END();
}

#define INST(ctype, mtype) \
template void WarpPerspectiveForwardImpl::kern_naive<ctype, mtype>( \
const KernParam<ctype, mtype>&, size_t);

INST(float, float);

#if !MEGDNN_DISABLE_FLOAT16
INST(dt_float16, float);
INST(dt_float16, dt_float16);
INST(dt_bfloat16, float);
INST(dt_bfloat16, dt_bfloat16);
#endif

INST(int8_t, float);
INST(uint8_t, float);

#undef INST

template <typename ctype, typename mtype>
void WarpPerspectiveForwardImpl::kern_naive_nhwcd4(
const KernParam<ctype, mtype>& kern_param, size_t task_id) {


Loading…
Cancel
Save