---
title: "init(rangeFrom:to:by:scalarType:)"
framework: coreml
role: symbol
role_heading: Initializer
path: "coreml/mltensor/init(rangefrom:to:by:scalartype:)"
---

# init(rangeFrom:to:by:scalarType:)

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

## Declaration

```swift
init<Scalar>(rangeFrom start: Scalar, to end: Scalar, by stride: Scalar.Stride, scalarType: Scalar.Type = Scalar.self) where Scalar : MLTensorScalar, Scalar : Strideable
```

## 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.
- `scalarType`: The scalar type.

## See Also

### Creating a tensor

- [init(_:)](coreml/mltensor/init(_:).md)
- [init(_:alongAxis:)](coreml/mltensor/init(_:alongaxis:).md)
- [init(_:scalarType:)](coreml/mltensor/init(_:scalartype:).md)
- [init(bytesNoCopy:shape:scalarType:deallocator:)](coreml/mltensor/init(bytesnocopy:shape:scalartype:deallocator:).md)
- [init(concatenating:alongAxis:)](coreml/mltensor/init(concatenating:alongaxis:).md)
- [init(linearSpaceFrom:through:count:)](coreml/mltensor/init(linearspacefrom:through:count:).md)
- [init(linearSpaceFrom:through:count:scalarType:)](coreml/mltensor/init(linearspacefrom:through:count:scalartype:).md)
- [init(ones:scalarType:)](coreml/mltensor/init(ones:scalartype:).md)
- [init(randomNormal:mean:standardDeviation:seed:scalarType:)](coreml/mltensor/init(randomnormal:mean:standarddeviation:seed:scalartype:).md)
- [init(randomUniform:in:seed:scalarType:)](coreml/mltensor/init(randomuniform:in:seed:scalartype:).md)
- [init(rangeFrom:to:by:)](coreml/mltensor/init(rangefrom:to:by:).md)
- [init(repeating:shape:)](coreml/mltensor/init(repeating:shape:).md)
- [init(repeating:shape:scalarType:)](coreml/mltensor/init(repeating:shape:scalartype:).md)
- [init(shape:data:scalarType:)](coreml/mltensor/init(shape:data:scalartype:).md)
- [init(shape:scalars:)](coreml/mltensor/init(shape:scalars:).md)
