Skip to content

🐛 [Bug] RuntimeError: linear convolution has bias of type <class 'tensorrt_bindings.tensorrt.ITensor'>, Expect Optional[Tensor] #2060

Closed
@peri044

Description

@peri044
Collaborator

Bug Description

RuntimeError: linear convolution has bias of type <class 'tensorrt_bindings.tensorrt.ITensor'>, Expect Optional[Tensor]

To Reproduce

import torch
import torch_tensorrt
import torchvision.models as models
import timm

class MyModule(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.conv = torch.nn.Conv2d(3, 16, 3, stride=1, bias=True)
        self.bn = torch.nn.BatchNorm2d(16)
        self.relu = torch.nn.ReLU()

    def forward(self, x):
        out = self.conv(x)
        out = self.bn(out)
        out = self.relu(out)
        return out

model = MyModule().eval().cuda()
input = torch.randn((1, 3, 224, 224)).to("cuda")
compile_spec = {
    "inputs": [
        torch_tensorrt.Input(
            input.shape, dtype=torch.float, format=torch.contiguous_format
        )
    ],
    "enabled_precisions": {torch.float},
    "debug": True,
    "is_aten": True,
    "min_block_size": 5,
}

trt_mod = torch_tensorrt.dynamo.backend.compile(model, **compile_spec)

Expected behavior

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • Torch-TensorRT Version (e.g. 1.0.0):
  • PyTorch Version (e.g. 1.0):
  • CPU Architecture:
  • OS (e.g., Linux):
  • How you installed PyTorch (conda, pip, libtorch, source):
  • Build command you used (if compiling from source):
  • Are you using local sources or building from archives:
  • Python version:
  • CUDA version:
  • GPU models and configuration:
  • Any other relevant information:

Additional context

Activity

gs-olive

gs-olive commented on Jun 27, 2023

@gs-olive
Collaborator

This one was fixed in #1972 - could you try the model again with that PR

github-actions

github-actions commented on Sep 26, 2023

@github-actions

This issue has not seen activity for 90 days, Remove stale label or comment or this will be closed in 10 days

gs-olive

gs-olive commented on Sep 26, 2023

@gs-olive
Collaborator

Fixed on main in recent linear converter implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @peri044@gs-olive

        Issue actions

          🐛 [Bug] RuntimeError: linear convolution has bias of type <class 'tensorrt_bindings.tensorrt.ITensor'>, Expect Optional[Tensor] · Issue #2060 · pytorch/TensorRT