-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Support Sparse Tensors in py_function #30069
Comments
I think now that we have compositetensor and typespec it should be straightforward to implement sparsetensor support in py_function by treating all composites generically. I don't have the bandwidth to do this now, so leaving as contributions welcome. |
@alextp I would like to work on this, can I please go ahead? |
Would "all composites" include ragged tensors, or should I create a separate feature request for that? Thanks! |
Composites include ragged tensors and a lot of other things as well. |
@pradyumna1 please go ahead! |
I notice that someone had already created issue #26453 (Allow py_function to support functions that return RaggedTensor). Implementing this feature using composite tensors would also satisfy that issue. |
I made changes in file |
@minhtriet, in a similar feature request (#27679), @edloper provided a helpful workaround in the form of a wrapper around |
Thank you @novog, I could not read work on it right now, would get back to you in a couple of days |
So, I updated Rerunning the code, the error is
My guess is that the creation of sparsed tensor works, but somehow |
This issue likely happens because the sparsetensor isn't being unpacked into its 3 component values. |
Hi @alextp, thank you for the reply. Right now I am using The call stack is
|
That doesn't make sense to me because SparseTensor is a composite:
So it's likely something else that is going on here. |
This issue is stale because it has been open for 180 days with no activity. It will be closed if no further activity occurs. Thank you. |
This issue was closed because it has been inactive for 1 year. |
Describe the feature and the current behavior/state.
Currently, sparse tensors don't seem to be supported as inputs to
py_function
. Attempting to pass one results in an error like "TypeError: Tensors in list passed to 'input' of 'EagerPyFunc' Op have types [<NOT CONVERTIBLE TO TENSOR>] that are invalid.
". Example:Will this change the current api? How?
Yes. The
inp
parameter ofpy_function
currently accepts a list ofTensor
objects; this change would broaden it to accept eitherTensor
s orSparseTensor
s. (Possibly_TensorLike
s?)Who will benefit with this feature?
Anyone wishing to pass sparse tensors to a
py_function
-wrapped function. There are situations where this wrapping is necessary; for example, functions passed toDataset.map
cannot perform certain operations unless the function is wrapped usingpy_function
.Any Other info.
The text was updated successfully, but these errors were encountered: