提交 1e3af4dd 编写于 作者: M Megvii Engine Team

fix(mgb/comp_node): add more info in `comp_node.to_string()`

GitOrigin-RevId: 794a8847aa9900a8362537f589f99f3da47755f1
上级 31031804
......@@ -66,7 +66,9 @@ void init_common(py::module m) {
.def_static("_get_default_device", &get_default_device)
.def("__str__", &CompNode::to_string_logical)
.def("__repr__", [](const CompNode& cn) {
return py::str("\"" + cn.to_string() + "\" from \"" + cn.to_string_logical() + "\"");
return mgb::ssprintf("CompNode(\"%s\" from \"%s\")",
cn.to_string_physical().c_str(),
cn.to_string_logical().c_str());
})
.def_static("_sync_all", &CompNode::sync_all)
.def(py::self == py::self)
......
test/resource/input_data.npy filter=lfs diff=lfs merge=lfs -text
test/resource/lite/shufflenet.mge filter=lfs diff=lfs merge=lfs -text
test/resource/lite/shufflenet_crypt_aes.mge filter=lfs diff=lfs merge=lfs -text
test/resource/lite/test_packed_model.lite filter=lfs diff=lfs merge=lfs -text
test/resource/lite/test_packed_model_rc4.lite filter=lfs diff=lfs merge=lfs -text
test/resource/lite/output_data.npy filter=lfs diff=lfs merge=lfs -text
test/resource/lite/model.mgb filter=lfs diff=lfs merge=lfs -text
test/resource/lite/liveness_rgb_nosub128.rknn filter=lfs diff=lfs merge=lfs -text
third_party/librknn_api filter=lfs diff=lfs merge=lfs -text
test/resource/lite/model_atlas.mgb filter=lfs diff=lfs merge=lfs -text
......@@ -368,8 +368,15 @@ class CompNode {
//! change to another stream on the same memory node
CompNode change_stream(int dest_stream) const;
//! get string representation of physical device
//! get string representation
std::string to_string() const {
return m_impl ? mgb::ssprintf("CompNode(\"%s\" from \"%s\")",
to_string_physical().c_str(),
to_string_logical().c_str()) : "invalid";
}
//! get string representation of physical device
std::string to_string_physical() const {
return m_impl ? m_impl->locator().to_string() : "invalid";
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册