-
Notifications
You must be signed in to change notification settings - Fork 32
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
Make Tensor generic and add ShapeMap and Rank types #21
base: main
Are you sure you want to change the base?
Conversation
Thank you for the help! In the cases where the |
@pparke Also, yes we can remove the
Do you think we could pull that off? The main problem currently is what I described. TS does not seem to understand that a |
@pparke also, I don't think I made that clear, but in the current implementation in the |
@pparke However, I think I now see what's happening here. |
@eduardoleao052 yes you are correct, it looks like I mixed up the two. Sorry about that, I only spent a few minutes setting up this draft PR so I must not have looked closely enough at their implementation. It seems like they don't even store the data in the objects they create which makes sense since the processing is done on GPU. When they need to return the data they call an async function to fetch it and then they transform it to the correct shape and return an I'm away travelling at the moment so I won't be able to do much this week but it looks like you're getting a good grasp on the data types. Feel free to close this PR if you've already made a lot of progress in another branch, it's only a draft anyways so not a lot of effort went into it. |
@pparke Thanks again for all the help! |
This PR is an attempt to implement the suggested types from #18
The types are the same as the ones in @tensorflow/tfjs-core and should be adapted to what this project requires if necessary.
TODO
ShapeMap[R]
to replace other instances ofArray<any>
At.backward
tril
Some of the other support functions may need to be updated in order to resolve the type errors. It would help to properly define types for the other functions that currently return
any
orArray<any>
. In depth knowledge of how those functions is needed and if the logic is changed we should first add unit tests that can be used to check if the output remains the same for all cases.