tqchen commented on a change in pull request #6315:
URL: https://github.com/apache/incubator-tvm/pull/6315#discussion_r474257087



##########
File path: python/tvm/target/target.py
##########
@@ -364,9 +394,11 @@ def create(target_str):
     ----
     See the note on :py:mod:`tvm.target` on target string format.
     """
-    if isinstance(target_str, Target):
+    if isinstance(target, Target):
         return target_str
-    if not isinstance(target_str, str):
-        raise ValueError("target_str has to be string type")
+    if isinstance(target, dict):
+        return _ffi_api.TargetFromConfig(target)
+    if isinstance(target, str):
+        return _ffi_api.TargetFromString(target)

Review comment:
       Given that it is one line to open and read the file. I think we can just 
allow it takes in string and not support the file path feature(because 
supporting both could be confusing). It also helps to avoid conflcits(e.g. what 
if there is a file with the same name).
   
   ```target = target.create(open("target.json").read())``` is not as bad




----------------------------------------------------------------
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.

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


Reply via email to