Skip to content

Load data that contain pytorch tensors #739

Answered by jpivarski
mariogeiger asked this question in Q&A
Discussion options

You must be logged in to vote

We intend to write code that recognizes all the major array-like types, and currently we're working on JAX, not pytorch yet. This Consortium for Python Data API Standards may help make that a one step thing.

For the moment, all of these array like types can be converted to NumPy, albeit manually as in your solution, and NumPy arrays can be viewed directly as Awkward Arrays. There is some documentation on that. Passing a numpy array directly to the ak.Array constructor or (equivalently but more explicitly) the ak.from_numpy function would avoid a conversion of the data into and back out of python objects, which can be slow and use up memory. Don't use ak.from_iter unless your data are alre…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by mariogeiger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants