Vector norms not interacting with dlarrays as documented
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm attempting to update a peice of code to support autograd and the final step of the script is to take the 1-norm of some data, then use autograd to find its first two derivatives. According to this page vecnorm() (and normalize() with the 'norm' method) should support doing this, however it will throw an error instead saying "Error using vecnorm Invalid data type. First argument must be single or double."
This can be reproduced easily by:
q = dlarray([2,2,2])
vecnorm(q,1,2) % can be any norm, not just 1-norm
q = double(q) % to make absolutely sure its a double dlarray
vecnorm(q,1,2)
Normalize, another function listed as having dlarray support, seems to have a similar behavior and outputs the same error message when run as
normalize(q,2,"norm")
I've verified that both functions work as documented when called on variables which are not dlarrays.
Am I doing something wrong or is there something else I'm missing? I'm running on r2023a.
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Image Data Workflows dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!