Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update variable name to avoid InvalidArgumentError (index out of bounds) in the last exercise in lab 1.1 #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

liangmicha
Copy link

Rename variable from matrix to images to prevent the following error:

InvalidArgumentError: slice index 2 of dimension 1 out of bounds. [Op:StridedSlice] name: strided_slice/

For reference, matrix is defined two cells up with:

matrix = tf.constant([["Tennis", "No"], ["Basketball", "Yes"], ["Baseball", "No"]])

(which is a matrix of shape [3,2]) (a 2-d tensor)

…ds) in the last exercise in lab 1.1

Rename variable from `matrix` to `images` to prevent the following error:
```
InvalidArgumentError: slice index 2 of dimension 1 out of bounds. [Op:StridedSlice] name: strided_slice/
```

For reference, matrix is defined two cells up with:
```
matrix = tf.constant([["Tennis", "No"], ["Basketball", "Yes"], ["Baseball", "No"]])
```
(which is a matrix of shape [3,2]) (a 2-d tensor)
@diegoquintanav
Copy link

diegoquintanav commented Feb 17, 2021

For reference, matrix is defined two cells up with:
matrix = tf.constant([["Tennis", "No"], ["Basketball", "Yes"], ["Baseball", "No"]])

I don't see this in the notebook, is it your own definition?

In my case, I solved it by changing the indexes: the previous cell asks for a 2x2 matrix, and therefore accessing matrix[1,2] is not going to work since python indexing starts at zero. I changed it to matrix[0,1] and it worked. Same goes for the other definitions in the same cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants