1
votes

I have a coreML model (converted from Keras) that produces output as a MLMultiArray of size (1,40,30,90)( e.g. name : finalOutput). This array is obtained from reshaping an internal tensor of dimension (1,10800,10)

I am not able to slice the finalOutput multiArray into three slices of dimensions (1,40,30,0:45) , ( 1,40,30,45:54) and (1,40,30,54:90).

these will then be reshaped into three subarrays of dimensions (1,10800,5) , (1,10800) amnd (1,10800,4).

I am new to swift programming in iOS world. I can easily do this in python without issues.

How do is SLICE multiarrays and RESHAPE multiArrays in Swift for iOS ?

Appreciate your help.

2

2 Answers

2
votes

There are no easy methods on MLMultiArray for slicing and reshaping. Maybe we'll something like this in iOS 12 but for the time being you'll have to do this sort of thing using pointer arithmetic.

0
votes

Take a look at this example which uses pointers to reshape