Skip to content

00_pytorch_fundamentals_exercises Qn 9 #181

Answered by mrdbourke
chewyh26 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @chewyh26,

First, fantastic question, the exercise + answers are a little confusing now I read them again.

And @JahoNematov thank you for your help and offerings.

I've got a hacked-together solution from some research online.

Namely via the use of NumPy's unravel_index().

Again this is where the confusion comes in because this is a PyTorch course not a NumPy course. But for most NumPy functions there is a PyTorch equivalent.

You can achieve the desired outcome of question 9 "Find the maximum and minimum index values of the output of 7" via the following:

import torch
x = torch.tensor([[0.3647, 0.4709],
                  [0.5184, 0.5617]])
x
>>> 
tensor([[0.3647, 0.4709], 
        [0.51…

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
3 replies
@chewyh26
Comment options

@ghost
Comment options

@chewyh26
Comment options

Comment options

You must be logged in to vote
3 replies
@ghost
Comment options

@ghost
Comment options

@chewyh26
Comment options

Comment options

You must be logged in to vote
1 reply
@chewyh26
Comment options

Comment options

You must be logged in to vote
1 reply
@chewyh26
Comment options

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