struct

ML::Strides

Inherits Struct / Value / Object

Stride descriptor for memory layout

Constructors

new(shape : Shape, contiguous : Bool = true)
Source
new(strides_arr : Array(Int32))
Source

Instance methods

[](index : Int32) : Int32
Source
contiguous?(shape : Shape) : Bool

Check if memory is contiguous (row-major)

Source
flat_index(indices : Array(Int32)) : Int32

Compute flat index from multi-dimensional indices

Source
flat_index(*indices : Int32) : Int32
Source
ndim
Source
strides
Source
to_a
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source