torch.jit.frontend.UnsupportedNodeError: ListComp aren't supported
See original GitHub issueHi, I’m trying to use torchaudio with Python 3.6, torch 1.0.0 and CUDA-10.0. I followed the README, but I get the error below:
>>> import torchaudio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/asc/audio/torchaudio/__init__.py", line 7, in <module>
from torchaudio import transforms, datasets, kaldi_io, sox_effects, legacy
File "/root/asc/audio/torchaudio/transforms.py", line 6, in <module>
from . import functional as F
File "/root/asc/audio/torchaudio/functional.py", line 40, in <module>
@torch.jit.script
File "/opt/conda/lib/python3.6/site-packages/torch/jit/__init__.py", line 689, in script
ast = get_jit_ast(fn, is_method=False)
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 147, in get_jit_ast
return build_def(ctx, py_ast.body[0], type_line, is_method)
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 182, in build_def
build_stmts(ctx, body))
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 124, in build_stmts
stmts = [build_stmt(ctx, s) for s in stmts]
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 124, in <listcomp>
stmts = [build_stmt(ctx, s) for s in stmts]
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 163, in __call__
return method(ctx, node)
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 312, in build_If
build_stmts(ctx, stmt.body),
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 124, in build_stmts
stmts = [build_stmt(ctx, s) for s in stmts]
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 124, in <listcomp>
stmts = [build_stmt(ctx, s) for s in stmts]
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 163, in __call__
return method(ctx, node)
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 245, in build_Assign
rhs = build_expr(ctx, stmt.value)
File "/opt/conda/lib/python3.6/site-packages/torch/jit/frontend.py", line 162, in __call__
raise UnsupportedNodeError(ctx, node)
torch.jit.frontend.UnsupportedNodeError: ListComp aren't supported
fill_value (float): Value to fill in
Outputs:
Tensor: Padded/trimmed tensor
"""
if max_len > tensor.size(len_dim):
# array of [padding_left, padding_right, padding_top, padding_bottom]
# so pad similar to append (aka only right/bottom) and do not pad
# the length dimension. assumes equal sizes of padding.
padding = [max_len - tensor.size(len_dim)
~ <--- HERE
if (i % 2 == 1) and (i // 2 != len_dim)
else 0
for i in [0, 1, 2, 3]]
# TODO add "with torch.no_grad():" back when JIT supports it
tensor = torch.nn.functional.pad(tensor, padding, "constant", fill_value)
elif max_len < tensor.size(len_dim):
tensor = tensor.narrow(len_dim, 0, max_len)
return tensor
How can I work it?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
torch.jit.frontend.UnsupportedNodeError ... - PyTorch Forums
I have just try to change ssd model from python to c++, but I got this error, and I'm using libtorch 1.0 stable....
Read more >torch.jit.frontend.unsupportednodeerror ... - You.com
frontend.UnsupportedNodeError: ListComp aren't supported fill_value (float): Value to fill in Outputs: Tensor: Padded/trimmed tensor """ if max_len > tensor ...
Read more >jit/frontend.py · neilisaac/torch - Gemfury
import torch import sys import ast import inspect import string from textwrap import dedent ... __name__) msg = "{} {}aren't supported".format(feature_name, ...
Read more >在C++ 平台上部署PyTorch 模型流程+踩坑实录 - 知行编程网
eg1. 报错torch.jit.frontend.UnsupportedNodeError: ListComp aren't supported. 可以改 ...
Read more >How to jit script a module that uses spectral norm?
torch\jit\frontend.py", line 286, in __call__ raise ... torch.jit.frontend.UnsupportedNodeError: GeneratorExp aren't supported: File "[.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is probably the same issue as https://github.com/pytorch/audio/issues/121. A fix should be created soon but you could build from commit d92de5b97fc6204db4b1e3ed20c03ac06f5d53f0 until then.
@jamarshon, @9bow I’m ashamed to forget
--hard
option ofgit reset
command. It works fine! Thank you!