Choosing a convolution operation method

There are various types of convolution operations we can choose from, and different configurations in the same convolution layer lead to different results. Here, we will summarize the commonly used convolution operations and talk about their strengths and weaknesses:

  1. Vanilla convolution: This is the most common convolution operation in CNNs. A convolution takes fewer parameters than a fully connected layer (nn.Linear) with the same input/output size and can be calculated pretty fast with im2col (see Chapter 7, Image Restoration with GANs, for more details). You can use the following snippet to create a ReLu-Conv-BN group (of course, feel free to change the order of the three functions):
class ReLUConvBN(nn.Module): ...

Get Hands-On Generative Adversarial Networks with PyTorch 1.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.