Handle the case where a variables occurs multiple times in fgraph.outputs in inplace_elemwise_optimizer