---
title: "init(bytesNoCopy:length:deallocator:)"
framework: ML Compute
role: symbol
role_heading: Initializer
platforms: [iOS 14.5+, iPadOS 14.5+, Mac Catalyst 14.5+, macOS 11.3+, tvOS 14.5+]
path: "mlcompute/mlctensordata/init(bytesnocopy:length:deallocator:)"
---

# init(bytesNoCopy:length:deallocator:)

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

## Declaration

```swift
convenience init(bytesNoCopy bytes: UnsafeMutableRawPointer, length: Int, deallocator: @escaping (UnsafeMutableRawPointer, Int) -> Void)
```

## Parameters

- `bytes`: A buffer that contains data.
- `length`: The number of bytes you want to reference from bytes. This number must not exceed the length of bytes.
- `deallocator`: A callback to invoke after the system deallocates the object instance.

## Return Value

Return Value A new MLCTensorData instance.

## See Also

### Creating Tensor Data

- [init(bytesNoCopy:length:)](mlcompute/mlctensordata/init(bytesnocopy:length:).md)
- [init(immutableBytesNoCopy:length:)](mlcompute/mlctensordata/init(immutablebytesnocopy:length:).md)
