Although within my notebook all the tests pass, the grader only gives me 3/5, saying:
Filename: Exercise 4B
3/5Score: 3 of 5
Hide grader output
Grader output
Code Cell UNQ_C1: Function 'calculate_updated_noise' is correct.
Code Cell UNQ_C2: Unexpected error (AttributeError("module 'torch' has no attribute 'subtract'",)) occurred during function check. We expected function `get_score` to return True. Please check that this function is defined properly.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.
I found the thread where people were having grading problems because they used the wrong norm function. I am using torch.norm()
everywhere, so that shouldn’t be the problem. Does the grader’s PyTorch not have torch.subtract()
?
Here are you using a torch subtract method somewhere, that might be a problem!
There are a number of cases in which the grader uses an older version of Torch. So you just have to find instances of the more advanced APIs that you are using and downgrade them.
Here’s another thread with a different example of this issue from GANs C1. And here’s one involving torch.square
.
1 Like
What is wrong with torch.subtract?
Did you read my reply and follow the links that I gave?
I did not need to invoke torch.subtract
in order to implement get_score
. Try just subtracting the tensors using good old fashioned “-” and see if that helps.
1 Like
I did see and read them, but they seem to be about other functions causing the same general problem. It seems that changing torch.subtract
to torch.sub
got me passed that error. But that then resulted in
Code Cell UNQ_C1: Function 'calculate_updated_noise' is correct.
Code Cell UNQ_C2: Unexpected error (AttributeError("module 'torch' has no attribute 'multiply'",)) occurred during function check. We expected function `get_score` to return True. Please check that this function is defined properly.
If you see many functions being marked as incorrect, try to trace back your steps & identify if there is an incorrect function that is being used in other steps.
This dependency may be the cause of the errors.
I just changed torch.multiply
to torch.mul
, currently waiting to see if that was enough for the grader to pass me.
Edit: It did pass me now, but very annoying pitfall, whoever is in charge of the grading ought to fix that.
The underlying problem is that the grader appears to use an older version of torch
than the notebooks. As you can see from the other threads I linked, this has been known for a quite a while. I reported it to the course staff when we first encountered it, but nothing has happened as yet.