Contents

strides

An array of strides, in elements, one for each dimension of this tensor, if applicable.

Declaration

var strides: MTLTensorExtents? { get }

Discussion

You are responsible for ensuring strides meets the following requirements:

  • The first element of strides must be 1.

  • If usage contains machineLearning, the second element of strides must be aligned to 64 bytes, and for any i larger than 1, strides[i] must equal strides[i-1] * dimensions[i-1].

  • If dataType is a format MTLTensorDataType, for any i greater than or equal to 1, strides[i] must be aligned to 128 bytes. This is not a requirement for non-format data types, but following this convention improves performance.

This property is non-nil only for tensors created from a buffer.