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 struct
Slice
struct Slice
Registers the mo.slice graph op with the graph compiler.
Implemented traits
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:
update_input_view
static def update_input_view[dtype: DType, rank: Int, //, output_static_shape: IntTuple, static_starts: IntTuple, static_steps: IntTuple](input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], starts: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=starts.static_spec], stops: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=stops.static_spec], steps: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=steps.static_spec]) -> ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec.with_tile_layout_and_alignment[rank, Layout[TypeList[#kgen.param_list.tabulate(len[IntTuple](output_static_shape), [idx: __mlir_type.index] ComptimeInt[SIMD[IntTuple](output_static_shape[Int(idx)])] if (xor identical(SIMD[IntTuple](output_static_shape[Int(idx)]), -1), True) else Int)](), TypeList[#kgen.param_list.tabulate(rank, [idx: __mlir_type.index] ComptimeInt[Int((mul input.static_spec.static_layout.__stride_types[idx].static_value, #kgen.param_list.tabulate(len[IntTuple](static_steps), [idx: __mlir_type.index] ComptimeInt[SIMD[IntTuple](static_steps[Int(idx)])] if (xor identical(SIMD[IntTuple](static_steps[Int(idx)]), -1), True) else Int)[idx].static_value))] if input.static_spec.static_layout.__stride_types[idx].is_static_value and #kgen.param_list.tabulate(len[IntTuple](static_steps), [idx: __mlir_type.index] ComptimeInt[SIMD[IntTuple](static_steps[Int(idx)])] if (xor identical(SIMD[IntTuple](static_steps[Int(idx)]), -1), True) else Int)[idx].is_static_value else Int)]()]](Slice.get_view_alignment[rank, dtype, coord_to_int_tuple[input.static_spec.static_layout._stride_types](), static_starts, static_steps](input.static_spec.alignment))]
Returns:
execute
static def execute[target: StringSpan[ImmStaticOrigin], _trace_name: StringSpan[ImmStaticOrigin], static_starts: IntTuple, static_steps: IntTuple, dtype: DType, rank: Int](output: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=output.static_spec], input: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=input.static_spec], starts: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=starts.static_spec], stops: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=stops.static_spec], steps: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=steps.static_spec], ctx: DeviceContext)