From 846642a881eb2d255827a8f0739468f81ac754eb Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Mon, 26 Apr 2021 13:12:09 +0800 Subject: [PATCH] docs(misc): add some notes GitOrigin-RevId: de243064c5b50c27c04e207c2aeb921e284b2bbe --- imperative/src/impl/interpreter/option_manager.h | 1 + imperative/src/include/megbrain/imperative/utils/to_string.h | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/imperative/src/impl/interpreter/option_manager.h b/imperative/src/impl/interpreter/option_manager.h index 8100c15de..c140b1f47 100644 --- a/imperative/src/impl/interpreter/option_manager.h +++ b/imperative/src/impl/interpreter/option_manager.h @@ -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" diff --git a/imperative/src/include/megbrain/imperative/utils/to_string.h b/imperative/src/include/megbrain/imperative/utils/to_string.h index 7a8dc9b13..92825db93 100644 --- a/imperative/src/include/megbrain/imperative/utils/to_string.h +++ b/imperative/src/include/megbrain/imperative/utils/to_string.h @@ -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 struct ToStringTrait; +// Call `to_string` to print your value template std::string to_string(const T& value) { return ToStringTrait{}(value); @@ -92,7 +96,6 @@ template <> struct ToStringTrait{ 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); -- GitLab