<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLModel/prediction(from:)-7vsm8",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "s:So7MLModelC6CoreMLE10prediction4fromSDySSAC8MLTensorVGAH_tYaKF"
  },
  "title" : "prediction(from:)"
}
-->

# prediction(from:)

Run a prediction on a model.

```
func prediction(from inputs: [String : MLTensor]) async throws -> [String : MLTensor]
```

## Parameters

`inputs`

The named input, or inputs, to make a prediction from.

## Return Value

The output, or outputs, from the prediction.

## Discussion

This method requires all inputs and outputs to be multidimensional arrays. If your model doesn’t satisfy
this requirement, materialize the tensor inputs to `MLShapedArray` values to create feature
values for each, for example:

```swift
let shapedArray = await tensor.shapedArray(of: Float.self)
let inputFeatures = try MLDictionaryFeatureProvider(dictionary: [
    "x": MLFeatureValue(shapedArray: shapedArray),
    // Other non-multidimensional array inputs
])
let prediction = try await model.prediction(from: inputFeatures)
```

---

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)