mirror of
https://github.com/zebrajr/pytorch.git
synced 2026-01-15 12:15:51 +00:00
Summary: According to https://docs.python.org/3/tutorial/inputoutput.html, it is good practice to use the "with" keyword when dealing with file objects. If not, you should call f.close() to close the file and immediately free up any system resources used by it. Thus, I adjust the open file function to "with open() as f". Pull Request resolved: https://github.com/pytorch/pytorch/pull/18017 Differential Revision: D14475112 Pulled By: ezyang fbshipit-source-id: d1c0821e39cb8a09f86d6d08b437b4a99746416c