opened
umanwizard
username_0
## 🐛 Bug
This works on 1.1.0 for me but fails on master.
**test.py**
```python
import torch
@torch.jit.script
def foo(x):
    return torch.sum(x, dim=1)
```
**error message**
```
Traceback (most recent call last):
  File "./test.py", line 3, in <module>
    def foo(x):
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/__init__.py", line 1079, in script
    ast = get_jit_def(obj)
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 169, in get_jit_def
    return build_def(ctx, py_ast.body[0], type_line, self_name)
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 209, in build_def
    build_stmts(ctx, body))
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 125, in build_stmts
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 125, in <listcomp>
    stmts = [build_stmt(ctx, s) for s in stmts]
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 185, in __call__
    return method(ctx, node)
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 288, in build_Return
    return Return(r, None if stmt.value is None else build_expr(ctx, stmt.value))
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 185, in __call__
    return method(ctx, node)
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 422, in build_Call
    kw_expr = build_expr(ctx, kw.value)
  File "/Users/btv/pysandbox/lib/python3.8/site-packages/torch/jit/frontend.py", line 184, in __call__
    raise UnsupportedNodeError(ctx, node)
torch.jit.frontend.UnsupportedNodeError: Constant aren't supported
at ./test.py:4:29
@torch.jit.script
def foo(x):
    return torch.sum(x, dim=1)
                            ~ <--- HERE
```
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

```
Collecting environment information...
PyTorch version: 1.2.0a0+b527e48
Is debug build: Yes
CUDA used to build PyTorch: None

OS: Mac OSX 10.14.4
GCC version: Could not collect
CMake version: version 3.12.4

Python version: 3.8
Is CUDA available: No
CUDA runtime version: No CUDA
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA

Versions of relevant libraries:
[pip] Could not collect
[conda] Could not collect
```

## Additional context

<!-- Add any other context about the problem here. -->
Can't use constants in jit script
issue
created
ailzhang
username_1
@username_0  Which commit are you on? It seems to be working on my side.
comment
created
umanwizard
username_0
This is possibly a Python version issue since I am on 3.8 (which is unreleased). Let me try on 3.7.
comment
created
umanwizard
username_0
I think this is because of commit [3f2281](https://github.com/python/cpython/commit/3f22811fef73aec848d961593d95fa877f77ecbf) in Python.
comment