22.02.2024 Views

Daniel Voigt Godoy - Deep Learning with PyTorch Step-by-Step A Beginner’s Guide-leanpub

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Output

----------------------------------------------------------------

ValueError

Traceback (most recent call last)

<ipython-input-9-fa0fcce9e228> in <module>

----> 1 last_horizontal_region * identity

ValueError: operands could not be broadcast together with shapes

(1,1,3,2) (1,1,3,3)

Shape

Next, we go back to the left side and move down one step. If we repeat the

operation, covering all valid regions, we’ll end up with a resulting image that is

smaller (on the right).

Figure 5.8 - Fully convolved

"How much smaller is it going to be?"

It depends on the size of the filter.

The larger the filter, the smaller the resulting image.

Since applying a filter always produces a single value, the reduction is equal to the

filter size minus one. If the input image has (h i , w i ) shape (we’re disregarding the

channel dimension for now), and the filter has (h f , w f ) shape, the shape of the

resulting image is given by:

Equation 5.1 - Shape after a convolution

Convolutions | 351

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!