---
title: "init(dictionary:)"
framework: coreml
role: symbol
role_heading: Initializer
path: "coreml/mlarraybatchprovider/init(dictionary:)"
---

# init(dictionary:)

Creates a batch provider based on feature names and their associated arrays of data.

## Declaration

```swift
init(dictionary: [String : [Any]]) throws
```

## Parameters

- `dictionary`: A dictionary which maps feature names to an array of values. The error case occurs when all the arrays do not have the same length or the values in an aray are not expressible as an doc://com.apple.coreml/documentation/CoreML/MLFeatureValue.

## Discussion

Discussion This initializer is convenient when the data are available as individual arrays. let batch = try  MLArrayBatchProvider(dictionary: ["age": [30, 35, 29],                                                    "weightLbs": [120.0, 170.4, 213.6]])

## See Also

### Creating a batch provider

- [init(array:)](coreml/mlarraybatchprovider/init(array:).md)
