Hi,
What do you mean by this?
z.backward(all_trainable_variables_except_y())
w.backward(y)

The argument that backward takes is the gradient of the tensor you call backward on.
What do you try to do here?