Thanks for clear explanation. I understand W[1] is computed once now.
For O which contains [W[1], W[1], w[1], W[2], W[3]], the gradients of O[0],O[1],O[2] are computed independently, although  they have same value. I think the computation is wasted. Could gradients of O[0],O[1],O[2], W[1] wrt loss be the same? I hope that just one of gradients of O[0],O[1],O[2],W[1] are computed and the others share it.