Get_sub_volume function in C1W3_Assignment one-hot encode part

Hi!
I’m stuck on the get_sub_volume function. I guess there is a problem about the function. I tried to call

(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not)

Any suggestion?

Hi @Alberto_Zacchini,

After looking at your notebook, there are a few things wrong there.

  1. You are hard-coding the number of classes. You should not do that. It might pass you the tests, but it might fail down the line or in the autograder. As different unit tests might use different values.
  2. You ignored two very important pieces of information given in the comments
# randomly sample sub-volume by sampling the corner voxel
# hint: make sure to leave enough room for the output dimensions!

You are neither using random sampling (the exact function to use has been mentioned to you in the dropdown “Hints” section of the Ex 1 introduction), nor are you leaving room for the output dimensions.

Hope this helps,

Best,
Mubsi

Thanks! I will try to fix the code