Parcourir la source

fix: python.lang.security.audit.eval-detected.eval-detected-benchmark-scripts-tvm-ios_bert.py

kira-offgrid il y a 3 semaines
Parent
commit
3dc5d452a5
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      benchmark/scripts/tvm/ios_bert.py

+ 2 - 1
benchmark/scripts/tvm/ios_bert.py

@@ -1,3 +1,4 @@
+import ast
 import tvm
 from tvm import relay, autotvm
 from tvm import rpc, relay
@@ -60,7 +61,7 @@ def prepare_input():
     img_path = download_testdata(img_url, "cat.png", module="data")
     synset_path = download_testdata(synset_url, synset_name, module="data")
     with open(synset_path) as f:
-        synset = eval(f.read())
+        synset = ast.literal_eval(f.read())
         image = Image.open(img_path).resize((224, 224))
 
     image = np.array(image) - np.array([123.0, 117.0, 104.0])