diff --git a/imperative/python/src/common.cpp b/imperative/python/src/common.cpp index f91eb9b8ee37e4a890aa79b26cc1fc6702d6ec49..96d64b9e6772fa2bc8c7bfcd01808055eca8a225 100644 --- a/imperative/python/src/common.cpp +++ b/imperative/python/src/common.cpp @@ -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) diff --git a/lite/.gitattributes b/lite/.gitattributes deleted file mode 100644 index c268a9ab651063425e1c50893566b10bed7f84fc..0000000000000000000000000000000000000000 --- a/lite/.gitattributes +++ /dev/null @@ -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 diff --git a/src/core/include/megbrain/comp_node.h b/src/core/include/megbrain/comp_node.h index 87c362ed06fb4f9ec088f00a1acf88e904ae0f3c..d03a3efd159900a5e0fe904296ebe606d00eed14 100644 --- a/src/core/include/megbrain/comp_node.h +++ b/src/core/include/megbrain/comp_node.h @@ -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"; }