summaryrefslogtreecommitdiff
path: root/torch/serialization.py
diff options
context:
space:
mode:
authorAdam Paszke <adam.paszke@gmail.com>2017-04-10 13:51:04 -0700
committerSoumith Chintala <soumith@gmail.com>2017-04-11 14:48:54 -0700
commit81e972031d69f3e5e42a1dfe3a1284eb53ac117b (patch)
tree6ada2bad0559f27275270cf213e8c24a7bd90ccb /torch/serialization.py
parente9ff57176b832c6432d107ed245fac4373d51007 (diff)
downloadpytorch-81e972031d69f3e5e42a1dfe3a1284eb53ac117b.tar.gz
pytorch-81e972031d69f3e5e42a1dfe3a1284eb53ac117b.tar.bz2
pytorch-81e972031d69f3e5e42a1dfe3a1284eb53ac117b.zip
Handle all errors if Module's sources can't be retrieved
Diffstat (limited to 'torch/serialization.py')
-rw-r--r--torch/serialization.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/torch/serialization.py b/torch/serialization.py
index 1abd3fcbbe..700cb6dda3 100644
--- a/torch/serialization.py
+++ b/torch/serialization.py
@@ -142,7 +142,7 @@ def _save(obj, f, pickle_module, pickle_protocol):
try:
source_file = inspect.getsourcefile(obj)
source = inspect.getsource(obj)
- except (TypeError, IOError):
+ except: # saving the source is optional, so we can ignore any errors
warnings.warn("Couldn't retrieve source code for container of "
"type " + obj.__name__ + ". It won't be checked "
"for correctness upon loading.")