Skip to content

Cannot solve divisibility test on non-trivial expression #136044

@ezyang

Description

@ezyang

🐛 Describe the bug

Internal xref: https://fb.workplace.com/groups/6829516587176185/permalink/7886529994808167/

import torch

torch._dynamo.config.capture_scalar_outputs = True

@torch.compile(fullgraph=True)
def f(x):
    u0, u1 = x.tolist()
    torch._check_is_size(u0)
    if ((u0 + 10) * (u0 + 10)) % (u0 + 10) != 0:
        return torch.tensor(True)
    else:
        return torch.tensor(False)

f(torch.tensor([20, 21]))

A simple fix might be to avoid expanding at which point the divisibility is obvious. IDK.

cc @chauhang @penguinwu @isuruf

Versions

main

Metadata

Metadata

Assignees

Labels

module: dynamic shapesoncall: pt2triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions