sahilkhose / StackGAN-BERT

PyTorch implementation of StackGAN paper using BERT embeddings
MIT License
12 stars 4 forks source link

Conv2d bias #2

Closed sahilkhose closed 3 years ago

sahilkhose commented 3 years ago

https://github.com/sahilkhose/ganctober/blob/919fe491f310ffe06e28e7306cbc26dad70d2d86/src/layers.py#L73 Conv2d default bias=True : https://pytorch.org/docs/stable/generated/torch.nn.Conv2d.html

A very common mistake is to follow Conv2d with BatchNorm2d and to not mention bias=False in conv2d BatchNorm2d has bias : https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html

Hence 2 biases just adds to the model parameters without any help in the computation It is a common practice to set bias=False in conv whenever it is followed by a BatchNorm