-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Closed
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue
Description
🐛 Bug
tensor.bool()
doesn't work in torch.jit.script:
Code sample to reproduce this error:
class net(torch.nn.Module):
def __init__(self):
super(net,self).__init__()
def forward(self,x):
return x.bool()
model = net()
ts = torch.jit.script(model)
Error information:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-46-a62f4e0965b1> in <module>()
5 return x.bool()
6 model = net()
----> 7 ts = torch.jit.script(model)
E:\Program Files\Anaconda3\envs\torch\lib\site-packages\torch\jit\__init__.py in script(obj, optimize, _frames_up, _rcb)
1201
1202 if isinstance(obj, torch.nn.Module):
-> 1203 return torch.jit.torch.jit._recursive.recursive_script(obj)
1204
1205 qualified_name = _qualified_name(obj)
E:\Program Files\Anaconda3\envs\torch\lib\site-packages\torch\jit\_recursive.py in recursive_script(mod, exclude_methods)
171 filtered_methods = filter(ignore_overloaded, methods)
172 stubs = list(map(make_stub, filtered_methods))
--> 173 return copy_to_script_module(mod, overload_stubs + stubs)
174
175
E:\Program Files\Anaconda3\envs\torch\lib\site-packages\torch\jit\_recursive.py in copy_to_script_module(original, stubs)
93 setattr(script_module, name, item)
94
---> 95 torch.jit._create_methods_from_stubs(script_module, stubs)
96
97 # Now that methods have been compiled, take methods that have been compiled
E:\Program Files\Anaconda3\envs\torch\lib\site-packages\torch\jit\__init__.py in _create_methods_from_stubs(self, stubs)
1421 rcbs = [m.resolution_callback for m in stubs]
1422 defaults = [get_default_args(m.original_method) for m in stubs]
-> 1423 self._c._create_methods(self, defs, rcbs, defaults)
1424
1425 # For each user-defined class that subclasses ScriptModule this meta-class,
RuntimeError:
Unknown builtin op: aten::bool.
Here are some suggestions:
aten::Bool
aten::roll
The original call is:
at <ipython-input-46-a62f4e0965b1>:5:15
def forward(self,x):
return x.bool()
~~~~~~ <--- HERE
The suggestions ops can't work either.
Environment
Collecting environment information...
PyTorch version: 1.3.0+cpu
Is debug build: No
CUDA used to build PyTorch: None
OS: Microsoft Windows 7 Ultimate
GCC version: Could not collect
CMake version: version 3.12.2
Python version: 3.6
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:
[pip3] msgpack-numpy==0.4.3.2
[pip3] numpy==1.17.0
[pip3] torch==1.3.0+cpu
[pip3] torchsummary==1.5.1
[pip3] torchvision==0.4.0+cpu
[conda] Could not extract name and version from: 'torch 1.3.0+cpu'
[conda] Could not extract name and version from: 'torchsummary 1.5.1'
[conda] Could not extract name and version from: 'torchvision 0.4.0+cpu'
[conda] mkl 2017.0.3 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/mkl-2017.0.3-0.tar.bz2
cc @suo
driazati
Metadata
Metadata
Assignees
Labels
oncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queue