For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo function
arange_shape
def arange_shape[dtype: DType](start: Scalar[dtype], stop: Scalar[dtype], step: Scalar[dtype]) -> IndexList[Int(1)]
Computes the output shape (number of elements) for the arange operation.
Validates that step is non-zero and consistent with the start/stop
ordering, then returns the element count as a single-element IndexList.
Parameters:
- βdtype (
DType): Element type of the range values.
Args:
- βstart (
Scalar[dtype]): First value of the range. - βstop (
Scalar[dtype]): Exclusive upper (or lower) bound of the range. - βstep (
Scalar[dtype]): Spacing between consecutive values.
Returns:
IndexList[Int(1)]: A single-element IndexList holding the number of generated values.
Raises:
Error: If step is zero, or if the start/stop/step ordering is invalid.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!