MasterJH5574 commented on code in PR #18759:
URL: https://github.com/apache/tvm/pull/18759#discussion_r2796436801


##########
src/runtime/disco/loader.cc:
##########
@@ -56,57 +54,46 @@ struct ShardInfo {
   std::vector<ShardFunc> funcs;
 };
 
-template <typename ExpectedType>
-inline ExpectedType AsType(const picojson::value& json) {
-  ICHECK(json.is<ExpectedType>());
-  return json.get<ExpectedType>();
-}
-
-template <typename ValueType>
-inline ValueType GetValue(const picojson::object& json, const std::string& 
key) {
-  return AsType<ValueType>(json.at(key));
-}
-
 std::unordered_map<std::string, ShardInfo> LoadShardInfoFromStr(const 
std::string& json_str);
-ShardInfo::TensorInfo LoadTensorInfoFromJSON(const picojson::array& 
json_tensor_info) {
+
+ShardInfo::TensorInfo LoadTensorInfoFromJSON(const json::Array& 
json_tensor_info) {
   CHECK_EQ(json_tensor_info.size(), 2) << "ValueError: Invalid tensor info 
JSON";
-  picojson::array shape_json = AsType<picojson::array>(json_tensor_info[0]);
+  json::Array shape_json = json_tensor_info[0].cast<json::Array>();
   int ndim = shape_json.size();
   std::vector<int64_t> shape;
   shape.reserve(ndim);
   for (int i = 0; i < ndim; ++i) {
-    shape.push_back(AsType<int64_t>(shape_json[i]));
+    shape.push_back(shape_json[i].cast<int64_t>());
   }
-  std::string dtype = AsType<std::string>(json_tensor_info[1]);
+  std::string dtype = std::string(json_tensor_info[1].cast<ffi::String>());

Review Comment:
   Thanks! Updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to