From 31296e8f5fa9e7340f69344fbc8008554168b762 Mon Sep 17 00:00:00 2001 From: ANSHUMAN TRIPATHY Date: Sun, 10 May 2020 11:58:14 +0530 Subject: [PATCH] Review comments handled --- include/tvm/ir/attrs.h | 2 +- include/tvm/ir/function.h | 2 +- include/tvm/runtime/container.h | 2 +- src/ir/attrs.cc | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/tvm/ir/attrs.h b/include/tvm/ir/attrs.h index f3b760715a61c..819aafa0281cd 100644 --- a/include/tvm/ir/attrs.h +++ b/include/tvm/ir/attrs.h @@ -230,7 +230,7 @@ class DictAttrs : public Attrs { * \param dict The attributes. * \return The dict attributes. */ - TVM_DLL explicit DictAttrs(Map dict); + TVM_DLL explicit DictAttrs(Map dict); TVM_DEFINE_OBJECT_REF_METHODS(DictAttrs, Attrs, DictAttrsNode); TVM_DEFINE_OBJECT_REF_COW_METHOD(DictAttrsNode); diff --git a/include/tvm/ir/function.h b/include/tvm/ir/function.h index 5b9e0714e2023..00626e6d20a4f 100644 --- a/include/tvm/ir/function.h +++ b/include/tvm/ir/function.h @@ -188,7 +188,7 @@ inline TFunc WithAttr(TFunc func, const std::string& attr_key, ObjectRef attr_va if (node->attrs.defined()) { node->attrs.CopyOnWrite()->dict.Set(attr_key, attr_value); } else { - Map dict = {{attr_key, attr_value}}; + Map dict = {{attr_key, attr_value}}; node->attrs = DictAttrs(dict); } return func; diff --git a/include/tvm/runtime/container.h b/include/tvm/runtime/container.h index 86aca4ec122e5..e2f2453933a5b 100644 --- a/include/tvm/runtime/container.h +++ b/include/tvm/runtime/container.h @@ -569,7 +569,7 @@ inline String operator+(const std::string lhs, const String& rhs) { } inline std::ostream& operator<<(std::ostream& out, const String& input) { - out << input.operator std::string(); + out.write(input.data(), input.size()); return out; } diff --git a/src/ir/attrs.cc b/src/ir/attrs.cc index b8dbf78dcf7d8..edc81ae201b08 100644 --- a/src/ir/attrs.cc +++ b/src/ir/attrs.cc @@ -47,13 +47,9 @@ void DictAttrsNode::InitByPackedArgs(const runtime::TVMArgs& args, bool allow_un Array DictAttrsNode::ListFieldInfo() const { return {}; } -DictAttrs::DictAttrs(Map dict) { +DictAttrs::DictAttrs(Map dict) { ObjectPtr n = make_object(); - Map dict_copy; - for (auto iter : dict) { - dict_copy.Set(iter.first.operator std::string(), iter.second); - } - n->dict = std::move(dict_copy); + n->dict = std::move(dict); data_ = std::move(n); }