<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraphExecutable/specialize(with:inputTypes:compilationDescriptor:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraphExecutable(im)specializeWithDevice:inputTypes:compilationDescriptor:"
  },
  "title" : "specialize(with:inputTypes:compilationDescriptor:)"
}
-->

# specialize(with:inputTypes:compilationDescriptor:)

Specialize the executable and optimize it.

```
func specialize(with device: MPSGraphDevice?, inputTypes: [MPSGraphType], compilationDescriptor: MPSGraphCompilationDescriptor?)
```

## Parameters

`device`

Optional MPSGraph device to compile with.

`inputTypes`

Input types expected to be passed to the executable.

`compilationDescriptor`

Compilation descriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can.

## Discussion

Use this method to choose when specialization happens, else it occurs at encode time automatically.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)