Skip to content
Discussion options

You must be logged in to vote

The two notations do not have the same meaning, though can look like they are the same with some usages.

With x[i][j][k] you should think about it as indexing into a nested list of arrays, while the x[i, j, k] is more like specifying what ranges you would like in each dimension for a tensor. At first thought these seem equivalent but they are not.

Lets take away the 3rd dimension from your tensor for simplicity, so now you have a more traditional matrix.

In this notation with indexing as a sequence of operations (e.g. x[:][2]) you can see that x[:] is exactly the same as x, so x[:][2] is the exact same as x[2]. This means you're getting the 3rd array (index 2) in the array of arrays.

In [35

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shantanu-ghodgaonkar
Comment options

Answer selected by shantanu-ghodgaonkar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants