---
title: "specialize(with:inputTypes:compilationDescriptor:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraphexecutable/specialize(with:inputtypes:compilationdescriptor:)"
---

# specialize(with:inputTypes:compilationDescriptor:)

Specialize the executable and optimize it.

## Declaration

```swift
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

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