---
title: makeMachineLearningCommandEncoder()
framework: metal
role: symbol
role_heading: Instance Method
path: metal/mtl4commandbuffer/makemachinelearningcommandencoder()
---

# makeMachineLearningCommandEncoder()

Creates a machine learning command encoder.

## Declaration

```swift
func makeMachineLearningCommandEncoder() -> (any MTL4MachineLearningCommandEncoder)?
```

## Return Value

Return Value The created MTL4MachineLearningCommandEncoder instance , or nil if the function fails.
