IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

range_shape

def range_shape[dtype: DType](start: Scalar[dtype], stop: Scalar[dtype], step: Scalar[dtype]) -> IndexList[Int(1)]

Computes the output shape for the mo.range graph op.

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; must be non-zero.

Returns:

IndexList[Int(1)]: The output shape [num_elements] for the range tensor.