def METHOD_NAME(self):
    # Setting a new attribute inside forward()
    class Foo(torch.nn.Module):
        def __init__(self):
            super().__init__()
            self.a = torch.Tensor(3, 2)
        def forward(self, x):
            self.b = 2
            return x.sum() + self.a.sum() + self.b
    self.check_failure_on_export(Foo(), torch.Tensor(3, 2))