<!--
{
  "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(linearSpaceFrom:through:count:scalarType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core ML",
      "CoreML"
    ],
    "preciseIdentifier" : "s:6CoreML8MLTensorV15linearSpaceFrom7through5count10scalarTypeACx_xSixmtcAA0C6ScalarRzSBRzlufc"
  },
  "title" : "init(linearSpaceFrom:through:count:scalarType:)"
}
-->

# init(linearSpaceFrom:through:count:scalarType:)

Creates a one-dimensional tensor representing a sequence from a starting value, up to and including an end value, spaced evenly to
generate the number of values specified.

```
init<Scalar>(linearSpaceFrom start: Scalar, through end: Scalar, count: Int, scalarType: Scalar.Type = Scalar.self) where Scalar : MLTensorScalar, Scalar : BinaryFloatingPoint
```

## 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 the last element of the resulting sequence.

`count`

The number of values in the resulting sequence. `count` must be greater than `1`.

`scalarType`

The scalar type.

---

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)