Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Weight scaling is applied to bias as well #111

Open
HarikrishnanBalagopal opened this issue Mar 29, 2020 · 4 comments
Open

Weight scaling is applied to bias as well #111

HarikrishnanBalagopal opened this issue Mar 29, 2020 · 4 comments

Comments

@HarikrishnanBalagopal
Copy link

x = self.module(x)
if self.equalized:
x *= self.weight

The above implementation applies the weight scaling to the bias tensor as well. However in the original implementation (https://github.com/tkarras/progressive_growing_of_gans/blob/master/networks.py#L53-L59) weight scaling is NOT applied to bias tensor.

This makes sense since He normal initialization takes into account fan-in and fan-out which depends on the dimensionality of the weights, not the biases. https://medium.com/@prateekvishnu/xavier-and-he-normal-he-et-al-initialization-8e3d7a087528

@Molugan
Copy link
Contributor

Molugan commented May 14, 2020

Hello,
Sorry for the delay.
You're right I indeed missed that part. I'll see I have some tine to retrain the models with this modification.

@altairmn
Copy link

I don't think there's a bug. The objective of weight scaling is to control the gradients. In this implementation, when activations are scaled instead of the weights, the impact on weight gradients is the same because weights are multiplied with activations. However, since biases are added, the multiplier for activations does not affect the gradient. That is my understanding of it.

@NullCodex
Copy link

If you let bias = False then the module no longer contains bias. @HarikrishnanBalagopal. @altairmn can you explain your comment? In my mind there's definitely a difference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants