How to update network parameters with other source of weights

Suppose I have a network with output z = net(x) with parameters theta, now I need to update the network parameters with newgrad = grad * w, where the grad is the gradient of the output z with respect to the network parameters theta and w is calculated by some other ways. How can I do it ? Thank you!