How to import numpy array into swift Array?

Viewed 549

I have some 2-dimensional data of shape (1024, 4) that is stored as an array to a binary file in NumPy .npy format.

arr = np.array(<some >)
arr.shape
# >>> (1024, 4)

np.save(fileName, arr)
# >>> .../SomeData.npy

How can I import this data into a Swift Array? It would have helped me if the data were read column by column.

Finally I want to have something like this:

let imported : [Float] = ???
0 Answers
Related