Represents a compute device capable of running machine learning computations
and other tasks like analysis and processing of images, sound, etc.
Members (2)
get · iOS 17.0+
description
TypeScript
get description(): string
Swift declaration
var description: String { get }
A textual representation of this instance.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(describing:)`
initializer. This initializer works with any type, and uses the custom
`description` property for types that conform to
`CustomStringConvertible`:
struct Point: CustomStringConvertible {
let x: Int, y: Int
var description: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `description` property.
get · iOS 17.0+
allComputeDevices
TypeScript
static get allComputeDevices(): Array<MLComputeDevice>
Swift declaration
static var allComputeDevices: [MLComputeDevice] { get }
An array of all compute devices.
The array contains all the compute devices that are accessible. If a compute device becomes
inaccessible for some reason (for e.g. if an external GPU is unplugged) then `allComputeDevices`
will return an array without the compute device.
Some compute devices are exclusive to the domain ML frameworks such as Vision and not available
to CoreML. Use `MLModel.availableComputeDevices` to get the subset of devices available to CoreML.