triton-lang / triton

Development repository for the Triton language and compiler

Home Page:https://triton-lang.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question regarding stride

wookjeHan opened this issue · comments

Dear team,

I was wondering how the stride(e.g., x.stride(0)) is decided.
I thought if the shape and dtype of two tensors are same, the stride would also be the same.

However, I noted that in some cases, strides are different even with the same shape and dtype.

What makes the difference of stride in such cases and how the strides can be calculated?

Thanks in advance,

https://martinlwx.github.io/en/how-to-reprensent-a-tensor-or-ndarray/ contains a detailed discussion. stride is related to memory layout.
if shape and type are same, stride can still be different. Sride can be derived from shape if the tensor is contiguous (but not in general).