Matrix multiplication of a dlarray object in a custom loss function
4 views (last 30 days)
Show older comments
Sebastian Rosier
on 11 Oct 2022
Answered: Sebastian Rosier
on 17 Oct 2022
Hi,
I have written a deep learning training loop with a custom loss function. Within this loss function, the output of my basic feedforward network is a dlarray matrix ~50(C) x 2000(B). The 50 channels in this matrix are a condensed representation of my desired output, which is a larger ~1500(C) x 2000(B) matrix. The matrix product of the output of my feedforward network with another (known) matrix gets me to this desired matrix, and from this I would like to calculate the mse loss. Essentially I need to reverse the eigendecomposition and calculate loss for that larger matrix, followed by a call to dlgradient to train my network. From reading documentation it seems that mtimes is not fully supported with dlarray objects. Am I missing an obvious alternative way to do what I want? I can manually do the matrix multiplication using scalar multiplication within loops but this is hopelessly slow. I would have expected this to not be an unusual step within custom training loops... can anyone suggest a way to accomplish this?
Many thanks!
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!