提交 846642a8 编写于 作者: M Megvii Engine Team 提交者: huangxinda

docs(misc): add some notes

GitOrigin-RevId: de243064c5b50c27c04e207c2aeb921e284b2bbe
上级 fb8f1534
......@@ -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"
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册