<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.0.0",
    "iPadOS: 14.0.0 - 17.0.0",
    "macCatalyst: 14.0.0 - 17.0.0",
    "macOS: 11.0.0 - 14.0.0",
    "tvOS: 14.0.0 - 17.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCTensor/init(sequenceLengths:sortedSequences:featureChannelCount:batchSize:data:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ML Compute",
      "MLCompute"
    ],
    "preciseIdentifier" : "s:So9MLCTensorC9MLComputeE15sequenceLengths15sortedSequences19featureChannelCount9batchSize4dataABSgSaySiG_SbS2iSo0A4DataCSgtcfc"
  },
  "title" : "init(sequenceLengths:sortedSequences:featureChannelCount:batchSize:data:)"
}
-->

# init(sequenceLengths:sortedSequences:featureChannelCount:batchSize:data:)

Creates a tensor with the sequence lengths, sorting indicator, number of feature channels, batch size, and data you specify.

```
convenience init?(sequenceLengths: [Int], sortedSequences: Bool, featureChannelCount: Int, batchSize: Int, data: MLCTensorData? = nil)
```

## Parameters

`sequenceLengths`

An array that contains the variable lengths of sequences stored in the tensor.

`sortedSequences`

A Boolean that indicates whether you provide the sequence lengths sorted in descending order.

`featureChannelCount`

The number of feature channels.

`batchSize`

The tensor batch size.

`data`

The tensor data.

---

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)