-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamo fails to export data-dependent Tensor.tolist
#126685
Comments
While we can support tensors with variable size, for fundamental reasons we cannot support Python lists with variable sizes. You should see if you can avoid the tolist and split calls and do your operations without generating N tensors |
That makes sense; I wasn't sure if this was intended to work or not. In this case, I think I can avoid the call to I can imagine a way to potentially make this work (e.g., using symbolic lists and tuples), but it would be a major lift if there is not already a structure in place anticipating it. |
This is something that I am a bit sensitive to, because there's an overarching problem where people want to do data-dependent-ish computation, and sometimes there aren't convenient abstractions for avoiding the DtoH sync that a tolist() would entail. If you're able to share more details about your use case, that would help. |
The basic idea is that I have a sparse tensor parameter in a model that I keep decomposed as an I had been iterating over new indices to add them to the dict, using I believe that I can work around this particular issue relatively easily with some advanced indexing. At the moment, I've simply cut this part of my model out as I work on getting the rest exported to ONNX. |
Thanks for the explanation! Appending rows onto a Tensor is indeed something plain Tensors doesn't do so well at. |
馃悰 Describe the bug
I am running into a bug potentially related to #114483 where dynamo fails to export
Tensor.tolist
with data-dependent size. A minimal repro is below:Traceback
The offending function appears to ultimately be
aten.tensor_split.sections
. I tried to add a decomposition (below) for it alongside the one foraten.tensor_split.tensor_indices_or_sections
, but I ultimately get blocked by a similar error as above.`torch.tensor_split.sections` decomposition
Versions
Versions
cc @alexsamardzic @nikitaved @pearu @cpuhrsch @amjames @bhosmer @jcaip @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang
The text was updated successfully, but these errors were encountered: