IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/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. /max/get-started.md).

Mojo struct

Slice

struct Slice

Implemented traits​

AnyType, ImplicitlyDestructible

Methods​

get_view_alignment​

static def get_view_alignment[rank: Int, dtype: DType, input_strides: IntTuple, static_starts: IntTuple, static_steps: IntTuple](input_alignment: Int) -> Int

Returns:

Int

update_input_view​

static def update_input_view[dtype: DType, rank: Int, //, output_static_shape: IntTuple, static_starts: IntTuple, static_steps: IntTuple](input: ManagedTensorSlice[Input, static_spec=input.static_spec], starts: ManagedTensorSlice[Input, static_spec=starts.static_spec], stops: ManagedTensorSlice[Input, static_spec=stops.static_spec], steps: ManagedTensorSlice[Input, static_spec=steps.static_spec]) -> ManagedTensorSlice[Input, static_spec=input.static_spec.with_tile_layout_and_alignment[rank, Layout[*?, *?]](Slice.get_view_alignment[rank, dtype, StaticTensorSpec[dtype, rank, input.static_spec.static_layout, input.static_spec.InFusion, input.static_spec.OutFusion, input.static_spec.ComputeFusion, input.static_spec.ComputeFusionTile].strides_tuple, static_starts, static_steps](ManagedTensorSlice[Input, static_spec=input.static_spec].alignment))]

Returns:

ManagedTensorSlice[Input, static_spec=input.static_spec.with_tile_layout_and_alignment[rank, Layout[*?, *?]](Slice.get_view_alignment[rank, dtype, StaticTensorSpec[dtype, rank, input.static_spec.static_layout, input.static_spec.InFusion, input.static_spec.OutFusion, input.static_spec.ComputeFusion, input.static_spec.ComputeFusionTile].strides_tuple, static_starts, static_steps](ManagedTensorSlice[Input, static_spec=input.static_spec].alignment))]

execute​

static def execute[target: StringSlice[StaticConstantOrigin], _trace_name: StringSlice[StaticConstantOrigin], static_starts: IntTuple, static_steps: IntTuple, dtype: DType, rank: Int](output: ManagedTensorSlice[Output, static_spec=output.static_spec], input: ManagedTensorSlice[Input, static_spec=input.static_spec], starts: ManagedTensorSlice[Input, static_spec=starts.static_spec], stops: ManagedTensorSlice[Input, static_spec=stops.static_spec], steps: ManagedTensorSlice[Input, static_spec=steps.static_spec], ctx: DeviceContext)

shape​

static def shape(input: ManagedTensorSlice[Input, static_spec=input.static_spec], starts: ManagedTensorSlice[Input, static_spec=starts.static_spec], stops: ManagedTensorSlice[Input, static_spec=stops.static_spec], steps: ManagedTensorSlice[Input, static_spec=steps.static_spec]) -> IndexList[input.static_spec.rank]

Returns:

IndexList[input.static_spec.rank]