I didn’t see any formula that explained how reshape or view works, I’m mostly interested in linearly indexing an existing tensor. So for example:
Suppose you have a k dimensional tensor A, with shape (n1,n2,n3,…nk) and you reshape it to a 1 dimensional tensor B, what is the formula for associating the linear index of B to the k dimensional index of A?