For loop in custom loss function of deep neural network

조회 수: 2 (최근 30일)
Jubeyer Rahman
Jubeyer Rahman 2019년 12월 9일
댓글: Jubeyer Rahman 2019년 12월 13일
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개)

카테고리

Help CenterFile Exchange에서 Custom Training Loops에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by