Share via

Segv while using CoreML MLMulatiArray in app

evmd 1 Reputation point
2022-08-08T11:20:22.047+00:00

I am trying to use CoreML in my app. I am attempting to pass an MLMultiArray, but I'm not sure what the proper way to assign values to it from my C# float[]. I'm getting crashes in my app and it seems like it is from the MLMultiArray. They are segv and other crashes and in inconsistent spots. I've noticed sometimes they occur at random indices when I am assigning the value to the MLMultiArray. I am doing

modelInput[1, i, 1] = input[i];

Does anyone know if this is right or wrong or if there is a better way to pass a 3d array to a coreml model?

Developer technologies | .NET | Xamarin

1 answer

Sort by: Most helpful
  1. evmd 1 Reputation point
    2022-08-09T11:29:16.98+00:00

    I figured out the issue. modelInput's shape is 1,2000,1. I slipped up and am assigning to 1,i,1 when I should've been assigning to 0,i,0. With that change it no longer crashes. I guess I'm just surprised by the behavior it caused. Thank you for all your replies and help.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.