pytorch / pytorch/executorch

[Request help] Failed running call_function <built-in function getitem>

Open
#9,567 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module: user experience
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

I encountered the following issues when converting to PTE:
”RuntimeError: Failed running call_function (*(FakeTensor(..., size=(1, 7), dtype=torch.int64), (FakeTensor(..., size=(), dtype=torch.int64), slice(None, u34 + 1, None))), **{}):
Could not guard on data-dependent expression Eq(7, u34 + 1) (unhinted: Eq(7, u34 + 1)).  (Size-like symbols: u34)“

Related code

accept_length_item = accept_length.item() #  accept_length is a dynamic value
torch.int64 torch._check_is_size(accept_length_item)
torch._check(accept_length_item <= 6) 
torch._check(accept_length_item >= 0)
retrieve_indices[0, :accept_length_item + 1]

If "torch._check(accept_length_item <= 5) ",  there will be no issue here. But if "torch._check(accept_length_item <= 6) ", the above issue will occur. I think accept_length_item = 6 is legal for "retrieve_indices[0, :accept_length_item + 1]". Here the shape of retrieve_indices is [1, 7]. 

cc @mergennachin @byjlw

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named. Start by reproducing the PTE conversion with the shown dynamic slice and checks, then trace the handling of the data-dependent guard for accept_length_item == 6. Done means a [1, 7] retrieve_indices tensor converts successfully when accept_length_item is checked as <= 6, with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.