Thanks again @soulitzer ! I just had one doubt.  I’ll be obtaining the derivatives of each of the model’s parameters wrt A. So to update A, can I sum the obtained derivatives to obtain one single matrix of the same size as A , so that I can use the calculated gradients to update A?