Browse Source

fix(mgb): add error infomation for old version load new elemwise mode

GitOrigin-RevId: d425425d2f
release-1.11.1
Megvii Engine Team 2 years ago
parent
commit
edd3ee67ce
2 changed files with 8 additions and 2 deletions
  1. +4
    -1
      dnn/src/common/elemwise/opr_impl.cpp
  2. +4
    -1
      dnn/src/common/elemwise_multi_type/opr_impl.cpp

+ 4
- 1
dnn/src/common/elemwise/opr_impl.cpp View File

@@ -141,7 +141,10 @@ const ModeTrait& ModeTrait::from_mode(Mode mode) {
#pragma message "elemwise mode stripped"
#endif
}

megdnn_assert(
static_cast<std::size_t>(mode) < traits.size(),
"Invalid elemwise mode in this version. "
"Maybe this version is too old, and you may need to update.");
auto&& ret = traits.at(static_cast<int>(mode));
#if !MEGDNN_ELEMWISE_MODE_ENABLE_ALL
megdnn_assert(ret.arity);


+ 4
- 1
dnn/src/common/elemwise_multi_type/opr_impl.cpp View File

@@ -274,7 +274,10 @@ const ModeTrait& ModeTrait::from_mode(Mode mode) {
SET(init_bool_unary_op, ISINF);
#undef SET
}

megdnn_assert(
static_cast<std::size_t>(mode) < traits.size(),
"Invalid elemwise multitype mode in this version. "
"Maybe this version is too old, and you may need to update.");
return traits.at(static_cast<int>(mode));
}



Loading…
Cancel
Save