I understand, it’s a very minor issue, but still… It looks to me that the suggested solution for the second task of the Exercise 2: “image_batch_transposed = image_batch_with_channel.transpose(1, 3)“ is not correct. Because it switches “width” and “channels“, so result is “[batch_size, width, height, channels]“ instead of [batch_size, height, width, channels] as required in the task. It’s not obvious in the result, because height = width = 3, so I would recommend using different values for the height and the width in the problem condition to avoid the confusion, and suggesting the correct solution: “image_batch_transposed = image_batch_with_channel.transpose(1,2).transpose(2,3)“
Thank you!
Thanks for pointing this out! I will file an enhancement request. I guess they were really trying to demonstrate how the transpose operator works, but there’s an even simpler solution here: they are just adding the unitary channels dimension, so they could have just added it as the new 4th dimension directly to get (m, h, w, c) by using unsqueeze(3). But I guess that’s not the pedagogical point here. ![]()
I was just going through the exercise and just wanted to report the same think as @DAResaid pointed out.
Regarding your simpler solution, it is not possible for this exercise because the exercise has 2 steps. The first step is just to add the the dimension, and you only ‘realize’ it is in the wrong place at step 2 ![]()
This has been addressed (notebook updated), hence closing the thread.