For loop in custom loss function of deep neural network

2 次查看(过去 30 天)
Hi,
Can anyone tell me whether matlab allows for loop in the customized loss function of a deep neural network?
Does it support complex number calculation in the custom loss function as well?

采纳的回答

Mahesh Taparia
Mahesh Taparia 2019-12-13
Hi Jubeyer
You can define a custom loss function in MATLAB, for example you can refer to this link. You can use for loop inside this loss function. Using for loop in the loss function will slower the training process as this function will be called for each batch of each epoch.
  11 个评论
Mahesh Taparia
Mahesh Taparia 2019-12-13
Take the transpose of V_Y as you already did in your code previously.
Jubeyer Rahman
Jubeyer Rahman 2019-12-13
I think I should be more specific about the problem I am facing here:
Here, in this operation:
Apparent_Y=V_Y.*conj(B * V_Y);
Let's say V_Y is 500X20 and B is 500X500
From vectorized operation what I need is when B*V_Y will be executed: it has to be in a way that each individual column of V_Y has to be multiplied with the whole B matrix and the result will be another 500X20 matrix (each time a column of V_Y is multiplied with the whole B, a column of 500X1 will be created; these columns need to be in a concatenated form which will make the desired resultant matrix of 500X20 matrix). So, just transposing V_Y does not solve the problem neither the elementwise multiplication, and I am doubtful whether while taking derivative any repmat type command is allowed or not.

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by