Skip to content

Instantly share code, notes, and snippets.

@darcwader
Created October 29, 2017 14:05
Show Gist options
  • Save darcwader/0708a7ec56f19d559d0338a4e5e07bde to your computer and use it in GitHub Desktop.
Save darcwader/0708a7ec56f19d559d0338a4e5e07bde to your computer and use it in GitHub Desktop.
func multiarray(vector:[Int:Double]) -> MLMultiArray {
let array = try! MLMultiArray(shape: [NSNumber(integerLiteral: self.vocabulary.count)], dataType: .double)
for (key, value) in vector {
array[key] = NSNumber(floatLiteral: value)
}
return array
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment