Add more hint in the JIT tracer (#17957)
authorLu Fang <lufang@fb.com>
Wed, 13 Mar 2019 07:49:07 +0000 (00:49 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 13 Mar 2019 07:56:59 +0000 (00:56 -0700)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17957

So developer knows what action should be taken when model contains nondeterministic node

Reviewed By: dzhulgakov

Differential Revision: D14435923

fbshipit-source-id: 12d930185852f78c54efc8e90c51aa7c7c7faab5

torch/jit/__init__.py

index f210d38..1d214c8 100644 (file)
@@ -540,7 +540,8 @@ def _check_trace(check_inputs, func, executor_options, module, check_tolerance,
             has_warned[0] = True
             nondeterm_ops = [op for op in module.graph.nodes() if op.isNondeterministic()]
             if len(nondeterm_ops) > 0:
-                nondeterministic_ops_warning = "Trace had nondeterministic nodes. Nodes:\n"
+                nondeterministic_ops_warning = "Trace had nondeterministic nodes. "
+                nondeterministic_ops_warning += "Did you forget call .eval() on your model? Nodes:\n"
                 nondeterministic_ops_warning += "\n".join([indent(str(op)) for op in nondeterm_ops][:20])
                 nondeterministic_ops_warning += "\nThis may cause errors in trace checking. To disable trace checking,"\
                                                 " pass check_trace=False to torch.jit.trace()"