File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,7 @@ Because the ``forward`` method of this module uses control flow that is
9494dependent on the input, it is not suitable for tracing. Instead, we can convert
9595it to a ``ScriptModule ``.
9696In 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
117114If you need to exclude some methods in your ``nn.Module ``
118115because they use Python features that TorchScript doesn't support yet,
You can’t perform that action at this time.
0 commit comments