I have an NSArray of size (1, 5, 401) from a plist file. I want to copy that into MLMultiArray of the same shape and then pass it to a CoreML model in Swift. How can I copy the values from NSArray to MLMultiArray?
let filepath = Bundle.main.path(forResource:"testPlist", ofType: "plist")
let dict2 = NSDictionary(contentsOfFile: filepath!)
let test_input:NSArray = dict2?.object(forKey:"test_input") as! NSArray
let mlMultiArray_input = try? MLMultiArray (shape:[1,5,401],dataType : MLMultiArrayDataType.double)

dict2?.object(forKey:"test_input") as! NSArrayBig code smell here (you should not force cast optionals, nor be using "object(forKey)"). You should use Swift native array instead of NSArray. Then you will be able to use the array content easily.