KEMBAR78
compile creates FakeTensors with dynamic shapes even when dynamic=False when inputs are views · Issue #123298 · pytorch/pytorch · GitHub
Skip to content

compile creates FakeTensors with dynamic shapes even when dynamic=False when inputs are views #123298

@bdhirsh

Description

@bdhirsh

Example:

import torch
from torch.testing._internal.two_tensor import TwoTensor


@torch.compile(backend="aot_eager", dynamic=False)
def f(x):
    if x.shape[0] > 5:
        return x + 1
    else:
        return x + 2


x_inner = torch.ones(4)
x = TwoTensor(x_inner, x_inner)
x_view = x.view(2, 2)
out = f(x_view)

Running with TORCH_LOGS="+dynamic", you can see a lot of symint compute going on. If you put a breakpoint here, the returned FakeTensor has SymInts for its sizes, even though we compiled with dynamic=False

cc @eellison

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: fakeTensortriagedThis 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