<!--
{
  "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/MLTensor/init(rangeFrom:to:by:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "s:6CoreML8MLTensorV9rangeFrom2to2byACSf_S2ftcfc"
  },
  "title" : "init(rangeFrom:to:by:)"
}
-->

# init(rangeFrom:to:by:)

Creates a one-dimensional tensor representing a sequence from a starting value to, but not including, an end value, stepping by the
specified amount.

```
init(rangeFrom start: Float, to end: Float, by stride: Float.Stride)
```

## Parameters

`start`

The starting value to use for the sequence. If the sequence contains any values, the first one is `start`.

`end`

An end value to limit the sequence. `end` is never an element of the resulting sequence.

`stride`

The amount to step by with each iteration. `stride` must be positive.

---

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)