Skip to content

Commit

Permalink
closes #9. add warning for legacy code.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanpa committed Dec 29, 2017
1 parent eae802c commit 13e2970
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tensorboardX/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,12 @@ def add_graph(self, model, lastVar):
The implementation will be based to onnx backend as soon as onnx is stable enough.
"""
import torch
from distutils.version import LooseVersion
if LooseVersion(torch.__version__)>=LooseVersion("0.3"):
print('add_graph() only supports PyTorch v0.2. For PyTorch>=0.3, use add_graph_onnx()')
return
if not hasattr(torch.autograd.Variable, 'grad_fn'):
print('pytorch version is too old, how about build by yourself?')
print('add_graph() only supports PyTorch v0.2.')
return
self.file_writer.add_graph(graph(model, lastVar))

Expand Down

0 comments on commit 13e2970

Please sign in to comment.