Effacer les filtres
Effacer les filtres

Vector norms not interacting with dlarrays as documented

2 vues (au cours des 30 derniers jours)
Alex B
Alex B le 25 Avr 2024
Commenté : Alex B le 25 Avr 2024
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.

Réponse acceptée

Steven Lord
Steven Lord le 25 Avr 2024
According to the Release Notes, support for dlarrays in vecnorm was added in release R2023b.
  1 commentaire
Alex B
Alex B le 25 Avr 2024
That's my bad. I'll update to the next version, thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by