<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCTensorData"
  },
  "title" : "MLCTensorData"
}
-->

# MLCTensorData

An encapsulation of the memory that tensor data uses.

```
class MLCTensorData
```

## Overview> Important:
> A tensor data instance doesn’t take ownership of the `bytes` pointer and therefore won’t free it upon deallocation.

## Topics

### Creating Tensor Data

[`init(bytesNoCopy:length:)`](/documentation/MLCompute/MLCTensorData/init(bytesNoCopy:length:))

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

[`init(bytesNoCopy:length:deallocator:)`](/documentation/MLCompute/MLCTensorData/init(bytesNoCopy:length:deallocator:))

Creates a tensor data instance with a data buffer, byte length, and custom deallocator closure you specify.

[`init(immutableBytesNoCopy:length:)`](/documentation/MLCompute/MLCTensorData/init(immutableBytesNoCopy:length:))

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

### Inspecting Tensor Data

[`bytes`](/documentation/MLCompute/MLCTensorData/bytes)

A buffer that conains data.

[`length`](/documentation/MLCompute/MLCTensorData/length)

The number of bytes you choose to hold for this tensor data instance.



---

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)