Exercise

Max-pooling operator

Here you are going to practice using max-pooling in both OOP and functional way, and see for yourself that the produced results are the same. We have already created and printed the image for you, and imported torch library in addition to torch.nn and torch.nn.Functional as F packages.

Instructions

100 XP
  • Build a max-pooling operator with size 2.
  • Apply the max-pooling operator in the image (loaded as im).
  • Use a max-pooling operator in functional way in the image.
  • Print the results of both cases.