From 81e025d9ac9135acd991913715cc21a4497a4b79 Mon Sep 17 00:00:00 2001 From: James Reed Date: Sat, 9 Mar 2019 23:10:26 -0800 Subject: [PATCH] Clarify JIT docs Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17846 Differential Revision: D14400363 Pulled By: jamesr66a fbshipit-source-id: 862316b5fd95526b6edebeca19d2cc522779df11 --- torch/jit/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/torch/jit/__init__.py b/torch/jit/__init__.py index 62c3bc5..f210d38 100644 --- a/torch/jit/__init__.py +++ b/torch/jit/__init__.py @@ -1062,9 +1062,8 @@ if _enabled: + Tracing will not record any control-flow like if statements or loops. When this control-flow is constant across your module, this is fine and it often just inlines configuration decisions. But sometimes the control-flow is - actually part of the model itself. For instance, a beam search in - sequence-to-sequence translation is a loop over the (varying) sequence - length of inputs. + actually part of the model itself. For instance, a recurrent network is + a loop over the (possibly dynamic) length of an input sequence. + In the returned ``ScriptModule``, operations that have different behaviors in ``training`` and ``eval`` modes will always behave as if it is in the -- 2.7.4