Browse Source

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

GitOrigin-RevId: 794a8847aa
tags/v1.6.0-rc1
Megvii Engine Team 3 years ago
parent
commit
1e3af4dd17
3 changed files with 11 additions and 12 deletions
  1. +3
    -1
      imperative/python/src/common.cpp
  2. +0
    -10
      lite/.gitattributes
  3. +8
    -1
      src/core/include/megbrain/comp_node.h

+ 3
- 1
imperative/python/src/common.cpp View File

@@ -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)


+ 0
- 10
lite/.gitattributes View File

@@ -1,10 +0,0 @@
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

+ 8
- 1
src/core/include/megbrain/comp_node.h View File

@@ -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";
}



Loading…
Cancel
Save