<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCInferenceGraph",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCInferenceGraph"
  },
  "title" : "MLCInferenceGraph"
}
-->

# MLCInferenceGraph

An inference graph created from one or more MLCGraph instances plus additional layers added directly to the inference graph.

```
class MLCInferenceGraph
```

## Topics

### Creating Inference Graphs

[`init(graphObjects:)`](/documentation/MLCompute/MLCInferenceGraph/init(graphObjects:))

Creates an inference graph with the layers from the graph objects you specify.

### Preparing Inference Graphs

[`addInputs(_:)`](/documentation/MLCompute/MLCInferenceGraph/addInputs(_:))

Adds the inputs you specify to the inference graph.

[`addInputs(_:lossLabels:lossLabelWeights:)`](/documentation/MLCompute/MLCInferenceGraph/addInputs(_:lossLabels:lossLabelWeights:))

Adds the inputs, loss labels, and loss label weights that you specify to the inference graph.

[`addOutputs(_:)`](/documentation/MLCompute/MLCInferenceGraph/addOutputs(_:))

Adds the outputs you specify to the inference graph.

[`compile(options:device:)`](/documentation/MLCompute/MLCInferenceGraph/compile(options:device:))

Compiles the inference graph for the options and device you specify.

[`compile(options:device:inputTensors:inputTensorsData:)`](/documentation/MLCompute/MLCInferenceGraph/compile(options:device:inputTensors:inputTensorsData:))

Compiles the inference graph for the options, device, and input tensors you specify.

[`link(with:)`](/documentation/MLCompute/MLCInferenceGraph/link(with:))

Links the inference graphs you specify.

[`MLCGraphCompilationOptions`](/documentation/MLCompute/MLCGraphCompilationOptions)

A bitmask that specifies the options you use when compiling a graph.

### Executing Inference Graphs

[`execute(inputsData:batchSize:options:completionHandler:)`](/documentation/MLCompute/MLCInferenceGraph/execute(inputsData:batchSize:options:completionHandler:))

Executes the inference graph with the inputs data, batch size, execution options, and completion handler you specify.

[`execute(inputsData:outputsData:batchSize:options:completionHandler:)`](/documentation/MLCompute/MLCInferenceGraph/execute(inputsData:outputsData:batchSize:options:completionHandler:))

Executes the inference graph with the inputs and outputs data, batch size, execution options, and completion handler that you specify.

[`execute(inputsData:lossLabelsData:lossLabelWeightsData:batchSize:options:completionHandler:)`](/documentation/MLCompute/MLCInferenceGraph/execute(inputsData:lossLabelsData:lossLabelWeightsData:batchSize:options:completionHandler:))

Executes the inference graph with the input data, batch size, execution options and completion handler you specify.

[`execute(inputsData:lossLabelsData:lossLabelWeightsData:outputsData:batchSize:options:completionHandler:)`](/documentation/MLCompute/MLCInferenceGraph/execute(inputsData:lossLabelsData:lossLabelWeightsData:outputsData:batchSize:options:completionHandler:))

Executes the inference graph with the input and output data, batch size, execution options, and completion handler that you specify.

[`execute(inputsData:lossLabelsData:lossLabelWeightsData:outputsData:batchSize:options:)`](/documentation/MLCompute/MLCInferenceGraph/execute(inputsData:lossLabelsData:lossLabelWeightsData:outputsData:batchSize:options:))

Executes the inference graph with the input and output data, batch size, and execution options you specify.

[`MLCExecutionOptions`](/documentation/MLCompute/MLCExecutionOptions)

A bitmask that specifies the options you use when executing a graph.

[`MLCGraphCompletionHandler`](/documentation/MLCompute/MLCGraphCompletionHandler)

A callback completion handler you execute when a graph finishes execution.

### Inspecting Inference Graphs

[`deviceMemorySize`](/documentation/MLCompute/MLCInferenceGraph/deviceMemorySize)

The device memory size in bytes for all intermediate tensors in the inference graph.



---

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)