# What is the right way to find the alphas in this equation?

In the Grad-CAM++ paper the following equation (7) is posed (written here without the relu function): $$Y^c = \sum_k \Bigl( \Bigl\{ \sum_{a,b} \alpha_{ab}^{kc} \cdot \frac{\partial Y^c}{\partial A_{ab}^k} \Bigr\} \Bigl[ \sum_{i,j} A_{ij}^k \Bigr] \Bigr) \qquad (7)$$ $$Y^c$$ is supposed to be a function of the $$A_{ij}^k$$, and $$\alpha_{ab}^{kc}$$ are unknowns to be determined.

In order to isolate the alphas the paper computes partial derivatives w.r.t. $$A_{ij}^k$$ on both sides of the equation. In the computation no partial derivatives of the alphas with respect to $$A_{ij}^k$$ occur, so it seems that the alphas are considered independent from the $$A_{ij}^k$$. However this does not look right. To illustrate the problem assume that we want to find $$\alpha$$ in the equation $$\alpha x = x^2$$. If we follow the method used in the paper, i.e. differentiate both sides of the equation w.r.t. $$x$$ while assuming that $$\alpha$$ does not depend on $$x$$ (hence $$d\alpha/dx = 0$$), we will get $$\alpha = 2x$$, which is clearly incorrect. In fact differentiating both sides with respect to $$x$$ yields $$\frac{d\alpha}{dx} x + \alpha = 2x$$, which is not going to help isolating $$\alpha$$. The actual solution in this case is better obtained by dividing both sides by $$x$$, so $$\alpha = x^2/x = x$$, $$x\neq 0$$.

So, what it would be a right way to obtain alphas satisfying equation (7)?

Equation (7) in the Grad-CAM++ paper is linear. In fact for a given class $$c$$ we have just one equation and many unknowns (the $$\alpha_{ab}^{kc}$$), hence the equation is underdetermined and will have infinitely many solutions. The general solution will consist of picking an $$\alpha_{ab}^{kc}$$ with non zero coefficient, and assigning arbitrary values to the other alphas. Then, the $$\alpha_{ab}^{kc}$$ picked can be written as a linear combination of the other alphas.