-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Open
Labels
TSRootCause:DynamicBehaviorsTSRootCause:ModuleInheritanceTSUsabilityoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriage review
Description
🐛 Bug
I have a derived nn.Module
which calls super.forward(...)
in its own implementation. When I try to compile the code to TorchScript, I get:
Tried to access nonexistent attribute or method 'forward' of type 'Tensor'.:
File "test.py", line 7
def forward(self, x):
return super().forward(x)
~~~~~~~~~~~~~ <--- HERE
To Reproduce
import torch
import torch.nn as nn
class Foo(nn.Conv1d):
def forward(self, x):
return super().forward(x)
model = Foo(128, 128, 1)
torch.jit.script(model)
Expected behavior
I would expect to get a proper ScriptModule
out of the torch.jit.script(...)
line.
Environment
PyTorch version: 1.6.0
Is debug build: No
CUDA used to build PyTorch: 10.2
OS: Ubuntu 18.04.4 LTS
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
CMake version: Could not collect
Python version: 3.8
Is CUDA available: Yes
CUDA runtime version: 10.2.89
GPU models and configuration:
GPU 0: GeForce GTX 1080 Ti
GPU 1: GeForce GTX 1080 Ti
GPU 2: GeForce GTX 1080 Ti
GPU 3: GeForce GTX 1080 Ti
Nvidia driver version: 440.33.01
cuDNN version: /usr/lib/x86_64-linux-gnu/libcudnn.so.7.5.1
Versions of relevant libraries:
[pip3] numpy==1.19.1
[pip3] torch==1.6.0
[conda] _tflow_select 2.3.0 mkl
[conda] blas 1.0 mkl
[conda] cudatoolkit 10.2.89 hfd86e86_1
[conda] mkl 2020.1 217
[conda] mkl-service 2.3.0 py38he904b0f_0
[conda] mkl_fft 1.1.0 py38h23d657b_0
[conda] mkl_random 1.1.1 py38h0573a6f_0
[conda] numpy 1.19.1 py38hbc911f0_0
[conda] numpy-base 1.19.1 py38hfa32c7d_0
[conda] pytorch 1.6.0 py3.8_cuda10.2.89_cudnn7.6.5_0 pytorch
[conda] tensorflow 2.2.0 mkl_py38h6d3daf0_0
[conda] tensorflow-base 2.2.0 mkl_py38h5059a2d_0
cc @suo @gmagogsfm
scarecrow1123, ranrubin, hietalajulius, faraazn, kuynzereb and 15 morelopho and dvagala
Metadata
Metadata
Assignees
Labels
TSRootCause:DynamicBehaviorsTSRootCause:ModuleInheritanceTSUsabilityoncall: jitAdd this issue/PR to JIT oncall triage queueAdd this issue/PR to JIT oncall triage queuetriage review