Vector norms not interacting with dlarrays as documented
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alex B
el 25 de Abr. de 2024
Comentada: Alex B
el 25 de Abr. de 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.
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Data Workflows en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!