projects
/
platform
/
upstream
/
tvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9c383f6
)
[Python] Replace os.path.exists with try...except...else (#4784)
author
hlu1
<14827759+hlu1@users.noreply.github.com>
Wed, 29 Jan 2020 01:58:36 +0000
(17:58 -0800)
committer
GitHub
<noreply@github.com>
Wed, 29 Jan 2020 01:58:36 +0000
(09:58 +0800)
python/tvm/contrib/pickle_memoize.py
patch
|
blob
|
history
diff --git
a/python/tvm/contrib/pickle_memoize.py
b/python/tvm/contrib/pickle_memoize.py
index
5c16419
..
6e72aba
100644
(file)
--- a/
python/tvm/contrib/pickle_memoize.py
+++ b/
python/tvm/contrib/pickle_memoize.py
@@
-40,8
+40,12
@@
class Cache(object):
cache_by_key = {}
def __init__(self, key, save_at_exit):
cache_dir = ".pkl_memoize_py{0}".format(sys.version_info[0])
-
if not os.path.exists(cache_dir)
:
+
try
:
os.mkdir(cache_dir)
+ except FileExistsError:
+ pass
+ else:
+ self.cache = {}
self.path = os.path.join(cache_dir, key)
if os.path.exists(self.path):
try: