0

How to set right strides in MLMultiArray in Core ML? What's the EVERY strides' values' meaning?

For example, assume a Core ML model input shape is (1, 3, 1280, 720), so how to set strides when create MLMultiArray object by using initWithDataPointer:shape:dataType:strides:deallocator:error:?

I set strides as (720 * 1280, 720 * 1280, 720, 1) from some websites, but I don't know why set as this, or if it's right. What's the connection between shape and strides. No more documentation about it on Apple Developer website.

Smeegol
  • 2,014
  • 4
  • 29
  • 44
  • It looks like you are using a RGB image. Why not use the image type instead of multi-array? – Jeshua Lacock May 09 '22 at 05:53
  • @JeshuaLacock For some reason cannot use image type, just can use `MLMultiArray`. – Smeegol May 09 '22 at 07:34
  • You can create separated model with PyTorch or TF, then convert to coremltools to CoreML. Which can just convert from MLMultiArray to Image. Like in my article: https://medium.com/p/df93de9d2d46 – Dmytro Hrebeniuk May 10 '22 at 12:59

0 Answers0