Browse Source

docs(misc): add some notes

GitOrigin-RevId: de243064c5
release-1.5
Megvii Engine Team huangxinda 4 years ago
parent
commit
846642a881
2 changed files with 5 additions and 1 deletions
  1. +1
    -0
      imperative/src/impl/interpreter/option_manager.h
  2. +4
    -1
      imperative/src/include/megbrain/imperative/utils/to_string.h

+ 1
- 0
imperative/src/impl/interpreter/option_manager.h View File

@@ -25,6 +25,7 @@ public:
#define DEF_OPTION(name, env_key, default_value, desc) \
size_t name = (m_option_map[#name]=&name, get_option_from_env(env_key, default_value));

// Environ value would be read only when interpreter initializing.
DEF_OPTION(async_level, "MEGENGINE_INTERP_ASYNC_LEVEL", 2,
"config whether raise error exactly when invoking op.\n"
"level 2: both device and user side errors are async;\n"


+ 4
- 1
imperative/src/include/megbrain/imperative/utils/to_string.h View File

@@ -21,9 +21,13 @@

namespace mgb::imperative {

// Implement `ToStringTrait` for your printable class
// note that it should be either implemented in this file
// or in the same file with your class
template <typename T>
struct ToStringTrait;

// Call `to_string` to print your value
template <typename T>
std::string to_string(const T& value) {
return ToStringTrait<T>{}(value);
@@ -92,7 +96,6 @@ template <>
struct ToStringTrait<TensorShape>{
std::string operator()(TensorShape shape) const {
if (shape.ndim > TensorShape::MAX_NDIM) {
printf("ndim: %d\n", (int)shape.ndim);
return "[]";
}
mgb_assert(shape.ndim <= TensorShape::MAX_NDIM);


Loading…
Cancel
Save