---
title: MLFeatureValue
framework: coreml
role: symbol
role_heading: Class
path: coreml/mlfeaturevalue
---

# MLFeatureValue

A generic wrapper around an underlying value and the value’s type.

## Declaration

```swift
class MLFeatureValue
```

## Overview

Overview A Core ML feature value wraps an underlying value and bundles it with that value’s type, which is one of the types that MLFeatureType defines. Apps typically access feature values indirectly by using the methods in the wrapper class Xcode automatically generates for Core ML model files. If your app accesses an MLModel directly, it must create and consume MLFeatureProvider instances. For each prediction, Core ML accepts a feature provider for its inputs, and generates a separate feature provider for its outputs. The input feature provider contains one MLFeatureValue instance per input, and the output feature provider contains one per output. See MLFeatureDescription for more information about the model input and output features.

## Topics

### Creating a feature value

- [init(_:)](coreml/mlfeaturevalue/init(_:).md)

### Creating numeric feature values

- [init(int64:)](coreml/mlfeaturevalue/init(int64:).md)
- [init(double:)](coreml/mlfeaturevalue/init(double:).md)

### Creating string feature values

- [init(string:)](coreml/mlfeaturevalue/init(string:).md)

### Creating multidimensional feature values

- [init(multiArray:)](coreml/mlfeaturevalue/init(multiarray:).md)
- [init(shapedArray:)](coreml/mlfeaturevalue/init(shapedarray:).md)

### Creating collection feature values

- [init(dictionary:)](coreml/mlfeaturevalue/init(dictionary:).md)
- [init(sequence:)](coreml/mlfeaturevalue/init(sequence:).md)

### Creating image feature values

- [init(pixelBuffer:)](coreml/mlfeaturevalue/init(pixelbuffer:).md)
- [init(CGImage:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:pixelswide:pixelshigh:pixelformattype:options:)-2zg43.md)
- [init(CGImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:pixelswide:pixelshigh:pixelformattype:options:)-4nme0.md)
- [init(CGImage:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:constraint:options:)-1j00l.md)
- [init(CGImage:orientation:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:constraint:options:)-87vk0.md)
- [init(imageAtURL:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageaturl:pixelswide:pixelshigh:pixelformattype:options:).md)
- [init(imageAtURL:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageaturl:orientation:pixelswide:pixelshigh:pixelformattype:options:).md)
- [init(imageAtURL:constraint:options:)](coreml/mlfeaturevalue/init(imageaturl:constraint:options:).md)
- [init(imageAtURL:orientation:constraint:options:)](coreml/mlfeaturevalue/init(imageaturl:orientation:constraint:options:).md)
- [MLImageConstraint](coreml/mlimageconstraint.md)
- [MLFeatureValue.ImageOption](coreml/mlfeaturevalue/imageoption.md)

### Creating undefined feature values

- [init(undefined:)](coreml/mlfeaturevalue/init(undefined:).md)

### Accessing the feature’s type

- [type](coreml/mlfeaturevalue/type.md)

### Accessing the feature’s value

- [isUndefined](coreml/mlfeaturevalue/isundefined.md)
- [int64Value](coreml/mlfeaturevalue/int64value.md)
- [doubleValue](coreml/mlfeaturevalue/doublevalue.md)
- [stringValue](coreml/mlfeaturevalue/stringvalue.md)
- [imageBufferValue](coreml/mlfeaturevalue/imagebuffervalue.md)
- [shapedArrayValue(of:)](coreml/mlfeaturevalue/shapedarrayvalue(of:).md)
- [multiArrayValue](coreml/mlfeaturevalue/multiarrayvalue.md)
- [sequenceValue](coreml/mlfeaturevalue/sequencevalue.md)
- [dictionaryValue](coreml/mlfeaturevalue/dictionaryvalue.md)

### Comparing feature values

- [isEqual(to:)](coreml/mlfeaturevalue/isequal(to:).md)

### Supporting types

- [MLFeatureType](coreml/mlfeaturetype.md)
- [MLShapedArray](coreml/mlshapedarray.md)
- [MLShapedArrayProtocol](coreml/mlshapedarrayprotocol.md)
- [MLMultiArray](coreml/mlmultiarray.md)
- [MLSequence](coreml/mlsequence.md)

### Initializers

- [init(cgImage:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:constraint:options:)-30mu4.md)
- [init(cgImage:orientation:constraint:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:constraint:options:)-1djlw.md)
- [init(cgImage:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:orientation:pixelswide:pixelshigh:pixelformattype:options:)-8i6j0.md)
- [init(cgImage:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(cgimage:pixelswide:pixelshigh:pixelformattype:options:)-1pdp4.md)
- [init(coder:)](coreml/mlfeaturevalue/init(coder:).md)
- [init(imageAt:constraint:options:)](coreml/mlfeaturevalue/init(imageat:constraint:options:).md)
- [init(imageAt:orientation:constraint:options:)](coreml/mlfeaturevalue/init(imageat:orientation:constraint:options:).md)
- [init(imageAt:orientation:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageat:orientation:pixelswide:pixelshigh:pixelformattype:options:).md)
- [init(imageAt:pixelsWide:pixelsHigh:pixelFormatType:options:)](coreml/mlfeaturevalue/init(imageat:pixelswide:pixelshigh:pixelformattype:options:).md)

### Default Implementations

- [MLFeatureValue Implementations](coreml/mlfeaturevalue/mlfeaturevalue-implementations.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Model inputs and outputs

- [Making Predictions with a Sequence of Inputs](coreml/making-predictions-with-a-sequence-of-inputs.md)
- [MLSendableFeatureValue](coreml/mlsendablefeaturevalue.md)
- [MLFeatureProvider](coreml/mlfeatureprovider.md)
- [MLDictionaryFeatureProvider](coreml/mldictionaryfeatureprovider.md)
- [MLBatchProvider](coreml/mlbatchprovider.md)
- [MLArrayBatchProvider](coreml/mlarraybatchprovider.md)
- [MLModelAsset](coreml/mlmodelasset.md)
