Yes but this is not what you get here.
Since you backward a Tensor full of 1, you get for the grad of a1: 1*d(y1)/d(a1) + 1*d(y3)/d(a1) + 1*d(y3)/d(a1).
And I guess the same term will appear if you do the same for a2 and a3 hence the constant result that you see.