Skip to content

Commit c17b56c

Browse files
committed
close file after file has been used
1 parent 98fa4e9 commit c17b56c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

intel_pytorch_extension_py/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def __init__(self, mixed_dtype = torch.bfloat16, configure_file = None):
1818
# for int8 path, if user give a exited configure file, load it.
1919
if self.configure_file != None and self.dtype != torch.bfloat16:
2020
if os.path.exists(self.configure_file) and os.stat(self.configure_file).st_size != 0:
21-
f = open(self.configure_file)
22-
configures = json.load(f)
23-
core.load_indicators_file(configures)
21+
with open(self.configure_file, 'r') as f:
22+
configures = json.load(f)
23+
core.load_indicators_file(configures)
2424
else:
2525
assert False, 'Can not load a empty file or none existed file, plese first do calibartion step'
2626

0 commit comments

Comments
 (0)