<!--
{
  "availability" : [
    "iOS: 11.2.0 -",
    "iPadOS: 11.2.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.2 -",
    "tvOS: 11.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLCustomLayer/evaluate(inputs:outputs:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "c:objc(pl)MLCustomLayer(im)evaluateOnCPUWithInputs:outputs:error:"
  },
  "title" : "evaluate(inputs:outputs:)"
}
-->

# evaluate(inputs:outputs:)

Evaluates the custom layer with the given inputs.

```
func evaluate(inputs: [MLMultiArray], outputs: [MLMultiArray]) throws
```

## Parameters

`inputs`

The array of inputs to be evaluated.

`outputs`

The array of outputs to be populated by evaluating the given inputs.

## Discussion

Implement this method to evaluate the inputs using your layer’s custom behavior and to populate the output arrays. It will be called for each evaluation of your model performed on the CPU.

The memory for both input and output arrays is preallocated; don’t copy or move it. The inputs and outputs will have the shapes of the most recent call to [`outputShapes(forInputShapes:)`](/documentation/CoreML/MLCustomLayer/outputShapes(forInputShapes:)). Don’t modify the input values.

Investigate <doc://com.apple.documentation/documentation/Accelerate/veclib> for methods that could optimize your implementation significantly.

---

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)