Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

torch.arange free var issue #44

Open
anadeem2 opened this issue Aug 4, 2022 · 0 comments
Open

torch.arange free var issue #44

anadeem2 opened this issue Aug 4, 2022 · 0 comments

Comments

@anadeem2
Copy link
Contributor

anadeem2 commented Aug 4, 2022

I noticed while compiling model that I was getting RAF free var. Using the IR_DUMP Python frames, we were able to trace the free var to be caused be torch.arange op.
In my bert_layer.py when I create position_ids for embedding like this:

position_ids = torch.arange(
            seq_length, dtype=torch.long, device=
        input_ids.device)  

I get free var issue. However, this is simply resolved by doing this instead:

        position_ids = torch.arange(
            seq_length, dtype=torch.long
        ).to(input_ids.device)

I think the solution to this might be to implemented arange op & provide lowering to raf.arange in ratex. But I did not confirm as arange op does not show in LTC IR. Regardless, in case anyone sees similar issue, this would be a good reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant