Skip to content

🐛 [Bug] EliminateExceptionOrPassPattern removes list append #1027

@mfeliz-cruise

Description

@mfeliz-cruise

Bug Description

Exception or pass elimination incorrectly identifies an if block with only a list append in it as a removable exception. This changes model behavior and creates incorrect outputs.

GRAPH: [Torch-TensorRT - Debug Build] - Found that node  = prim::If(%51)
block0():
  %10 : Tensor[] = aten::append(%mod_list.1, %y.1)
  -> ()
block1():
  -> ()
is an exception or pass node (EliminateChecks)

To Reproduce

Steps to reproduce the behavior:

class ExceptionEliminationError(nn.Module):
    def __init__(self):
        super(ExceptionEliminationError, self).__init__()
    def forward(self, x, y):
        mod_list = [x]
        if x.sum() > y.sum():
            mod_list.append(y)
        z = torch.cat(mod_list)
        return z
  1. Attempt to compile the model above with torch-tensorrt

Expected behavior

The exception elimination pass should not remove this if.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions