Computing the gradients with respect to all parameters of a quantum neural network using a single circuit