Skip to content

Commit 7c62708

Browse files
committed
address david's feedback
1 parent f213e43 commit 7c62708

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

advanced_source/cpp_export.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ Because the ``forward`` method of this module uses control flow that is
9494
dependent on the input, it is not suitable for tracing. Instead, we can convert
9595
it to a ``ScriptModule``.
9696
In order to convert the module to the ``ScriptModule``, one needs to
97-
enable ``torch.jit._enable_recursive_script``
98-
and compile the module with ``torch.jit.script`` as follows::
97+
compile the module with ``torch.jit.script`` as follows::
9998

10099
class MyModule(torch.nn.Module):
101100
def __init__(self, N, M):
@@ -110,9 +109,7 @@ and compile the module with ``torch.jit.script`` as follows::
110109
return output
111110

112111
my_module = MyModule(10,20)
113-
114-
with torch.jit._enable_recursive_script():
115-
sm = torch.jit.script(my_module)
112+
sm = torch.jit.script(my_module)
116113

117114
If you need to exclude some methods in your ``nn.Module``
118115
because they use Python features that TorchScript doesn't support yet,

0 commit comments

Comments
 (0)