Reshaping a Numpy Array into lexicographical list of cubes of shape (n, n, n)
问题 In order to understand what I'm trying to achieve let's imagine an ndarray a with shape (8,8,8) from which I lexicographically take blocks of shape (4,4,4) . So while iterating through such blocks the indexes would look as follows: 0: a[0:4, 0:4, 0:4] 1: a[0:4, 0:4, 4:8] 2: a[0:4, 4:8, 0:4] 3: a[0:4, 4:8, 4:8] 4: a[4:8, 0:4, 0:4] 5: a[4:8, 0:4, 4:8] 6: a[4:8, 4:8, 0:4] 7: a[4:8, 4:8, 4:8] It is these blocks of data which I'm trying to access. Obviously, this can be described by using an