Effacer les filtres
Effacer les filtres

For loop in custom loss function of deep neural network

3 vues (au cours des 30 derniers jours)
Jubeyer Rahman
Jubeyer Rahman le 9 Déc 2019
Commenté : Jubeyer Rahman le 13 Déc 2019
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?

Réponse acceptée

Mahesh Taparia
Mahesh Taparia le 13 Déc 2019
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 commentaires
Mahesh Taparia
Mahesh Taparia le 13 Déc 2019
Take the transpose of V_Y as you already did in your code previously.
Jubeyer Rahman
Jubeyer Rahman le 13 Déc 2019
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by