---
title: "init(type:)"
framework: ML Compute
role: symbol
role_heading: Initializer
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlcdevice/init(type:)"
---

# init(type:)

Creates a device of the type you specify.

## Declaration

```swift
convenience init?(type: MLCDeviceType)
```

## Parameters

- `type`: The device type.

## Discussion

Discussion For the type parameter, use MLCDeviceType.any unless you need to control device selection. This ensures that the framework selects the best device to execute the neural network.

## See Also

### Creating Devices

- [init(type:selectsMultipleComputeDevices:)](mlcompute/mlcdevice/init(type:selectsmultiplecomputedevices:).md)
- [MLCDeviceType](mlcompute/mlcdevicetype.md)
- [init(gpuDevices:)](mlcompute/mlcdevice/init(gpudevices:)-4mj85.md)
- [cpu()](mlcompute/mlcdevice/cpu().md)
- [gpu()](mlcompute/mlcdevice/gpu().md)
- [ane()](mlcompute/mlcdevice/ane().md)
