Skip to content

🐛 [Bug] RuntimeError: Method 'forward' is not defined. #609

@zhenglongjiepheonix

Description

@zhenglongjiepheonix

Bug Description

To Reproduce

import torch
from torchvision.models.detection import fasterrcnn_resnet50_fpn
import trtorch

model = fasterrcnn_resnet50_fpn()
scripted = torch.jit.script(model)
trt = trtorch.compile(scripted, {"input_shapes": [(1, 3, 224, 224)]})# error occurs!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/zhenglongjie/miniconda3/envs/mmlab/lib/python3.7/site-packages/trtorch/_compiler.py", line 81, in compile
    compiled_cpp_mod = trtorch._C.compile_graph(module._c, _parse_compile_spec(compile_spec))
RuntimeError: Method 'forward' is not defined.

Expected behavior

no error should occur

Environment

Build information about the TRTorch compiler can be found by turning on debug messages

  • TRTorch Version (e.g. 0.2.0): 0.5.0a
  • PyTorch Version (e.g. 1.0):1.9
  • CPU Architecture:x86_64
  • OS (e.g., Linux):ubuntu 18.04
  • How you installed PyTorch (conda, pip, libtorch, source):pip
  • Build command you used (if compiling from source):
  • Are you using local sources or building from archives:
  • Python version:3.7
  • CUDA version:11.1
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions