Contents

strides

An array of strides, in elements, one for each dimension in the tensors you create with this descriptor, if applicable.

Declaration

@NSCopying var strides: MTLTensorExtents? { get set }

Discussion

You are responsible for ensuring strides meets the following requirements:

  • The first element of strides is one.

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

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

Only set this property when creating tensors from a buffer.