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
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()"