Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

代码中AFF模块中,为什么要用2×呢? #33

Open
YoungLNB opened this issue May 24, 2022 · 1 comment
Open

代码中AFF模块中,为什么要用2×呢? #33

YoungLNB opened this issue May 24, 2022 · 1 comment

Comments

@YoungLNB
Copy link

xo = 2 * x * wei + 2 * residual * (1 - wei)

@Sunkey2333
Copy link

作者之前在其他 issue 回答过:

I believe it has no impact on the training. The reason I use the multiplication of 2 is that I want to keep the total weights the same as addition.

In the direct addition case, X + Y is actually 1 * X + 1 * Y, the sum of the weight is 2. However, in a soft selection way, M(X+Y) * X + (1 - M(X+Y)) * Y, the sum of the weight is 1, so I multiply 2 to keep them the same. Then the only difference between 1 * X + 1 * Y and 2 * M(X+Y) * X + 2 * (1 - M(X+Y)) * Y is the dynamic weight allocation, but the sum of the weights keeps the same.

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

No branches or pull requests

2 participants