-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue
Description
This should work:
import torch
@torch.jit.script
def foo(x):
for i in range(1, 10):
x += float(i)
return x
print(foo.code)
Right now it does this:
Traceback (most recent call last):
File "param.py", line 3, in <module>
@torch.jit.script
File "/Users/jamesreed/onnx-fairseq/pytorch/torch/jit/__init__.py", line 739, in script
_jit_script_compile(mod, ast, _rcb, get_default_args(obj))
RuntimeError:
range() expects 1 argument but got 2:
@torch.jit.script
def foo(x):
for i in range(1, 10):
~~~~~~~~~~~~~~~~~~~~~~... <--- HERE
x += float(i)
return x
zasdfgbnm and sidazhang
Metadata
Metadata
Assignees
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue