1 year ago
#327043
user3157047
How copy an NSArray into MLMultiArray in Swift?
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)
swift
nsarray
plist
coreml
0 Answers
Your Answer