필터 지우기
필터 지우기

Vector norms not interacting with dlarrays as documented

조회 수: 2 (최근 30일)
Alex B
Alex B 2024년 4월 25일
댓글: Alex B 2024년 4월 25일
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.

채택된 답변

Steven Lord
Steven Lord 2024년 4월 25일
According to the Release Notes, support for dlarrays in vecnorm was added in release R2023b.
  댓글 수: 1
Alex B
Alex B 2024년 4월 25일
That's my bad. I'll update to the next version, thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by