<!--
{
  "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/MLMultiArray/transfer(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "c:objc(cs)MLMultiArray(im)transferToMultiArray:"
  },
  "title" : "transfer(to:)"
}
-->

# transfer(to:)

Transfer the contents to the destination multi-array.

```
func transfer(to destinationMultiArray: MLMultiArray)
```

## Parameters

`destinationMultiArray`

The transfer destination.

## Discussion

Numeric data will be up or down casted as needed. It can transfer to a multi-array with different layout (strides).

```swift
let sourceMultiArray: MLMultiArray = ... // shape is [2, 3] and data type is Float64

let newStrides = [4, 1]
let destinationMultiArray = MLMultiArray(shape: [2, 3], 
                                         dataType: .float32, 
                                         strides: newStrides)
sourceMultiArray.transfer(to: destinationMultiArray)
```

```objc
NSArray<NSNumber *> *shape = @[@2, @3];
NSArray<NSNumber *> *sourceStrides = @[@3, @1];
NSArray<NSNumber *> *destinationStrides = @[@4, @1];
MLMultiArray *source = [[MLMultiArray alloc] initWithShape:shape
                                                  dataType:MLMultiArrayDataTypeDouble
                                                   strides:sourceStrides];
// Initialize source...

MLMultiArray *destination = [[MLMultiArray alloc] initWithShape:shape
                                                       dataType:MLMultiArrayDataTypeFloat32
                                                        strides:destinationStrides];
[source transferToMultiArray:destination];
```

---

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)