I have two questions on MLShapedArray
.
1. Memory Layout
I'm using MLMultiArray
to get data into and out of a CoreML model. I need to preprocess the data before feeding it to the model, and right now I store it in a ContiguousArray
since I know that I can safely pass this to vDSP
methods.
I'm wondering if I could use an MLShapedArray
instead. Is an MLShapedArray
guaranteed to have a contiguous memory buffer underneath?
2. Memory Allocations
MLShapedArray
and MLMultiArray
have initializers that allow converting between them. Is data copied, or is the underlying buffer reused?
I'd love fo the buffer to be reused to avoid malloc calls. In my ML pipeline, I'd like to allocate all buffers at the start and then just reuse them as I do my processing.