<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCTensorData/init(immutableBytesNoCopy:length:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCTensorData(cm)dataWithImmutableBytesNoCopy:length:"
  },
  "title" : "init(immutableBytesNoCopy:length:)"
}
-->

# init(immutableBytesNoCopy:length:)

Creates a tensor data instance with the buffer of immutable data and length of bytes you specify.

```
convenience init(immutableBytesNoCopy bytes: UnsafeRawPointer, length: Int)
```

## Parameters

`bytes`

A buffer that contains immutable data.

`length`

The number of bytes you choose to reference from `bytes`. This number must not exceed the length of `bytes`.

## Discussion

> Important:
> Don’t mutate the underlying bytes in a tensor data instance you create with this initializer. Doing so may result in unexpected behavior.

---

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)