You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
now, toprint(i,j) is a double. But you are trying to assign to it a derivative of a scalar by a matrix. This means that this dInput(i,j)/dW is a matrix. Here input(,j) is the scalar and w is the matrix. If this is not clear to you, I advise you look into matrix calculus. Here is a good start on wiki, showing differences between, differentiating a scalar by a vector/matrix, differentiating a vector/matrix by a scalar, etc.
For this reason, dCpp does not allow you to differentiate with respect to a matrix, but only with respect to a scalar (var). This is clear from the signature of the function _.d(var &).
In other words, you need to differentiate with respect to each element separately, and store those derivatives where you'd like. It should be fairly simple to implement such functionality. Another point is that _.d(var &) returns a var. If you want to have a double, you need to call .id on it, as seen in the examples.
Considering the following snippet of code:
The previous snippet of code does not compile because of the following line:
My question is how, while leveraging dCpp, can I obtain a matrix representing the first derivate of y in respect to w?
The text was updated successfully, but these errors were encountered: