You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, after running a Pairwise distance calculation with a semi-metric distance metric this package returns an NxN matrix even though it is symmetric across the diagonal.
For my purposes I need to extract just the values from the lower triangular portion for further operation. This sounds trivial (and I'm sure that it is), but it is in a differentiable loss function where I'm using Zygote, which raises an error when mutating arrays*. So if I use tril or a list comprehension to extract the values, the code errors (eg https://stackoverflow.com/questions/50651781/extract-lower-triangle-portion-of-a-matrix). The vec command doesn't, but it doesn't give me what I need.
I know that in the background if the distance is semi-metric then it's not actually calculating the redundant portion. I'm wondering if there is a quick and easy way to grab the actually unique values of the distance metric from one of these semi-metric structures, since it sounds like that may be the form it's actually in before constructing the matrix.
*In a related note, Zygote errors for colwise distance calculations but not pairwise for the same reason. This is less urgent, but is there a way to perform the colwise calculation without mutations that break Zygote automatic differentiation?
The text was updated successfully, but these errors were encountered:
Hello, after running a Pairwise distance calculation with a semi-metric distance metric this package returns an NxN matrix even though it is symmetric across the diagonal.
For my purposes I need to extract just the values from the lower triangular portion for further operation. This sounds trivial (and I'm sure that it is), but it is in a differentiable loss function where I'm using Zygote, which raises an error when mutating arrays*. So if I use tril or a list comprehension to extract the values, the code errors (eg https://stackoverflow.com/questions/50651781/extract-lower-triangle-portion-of-a-matrix). The vec command doesn't, but it doesn't give me what I need.
I know that in the background if the distance is semi-metric then it's not actually calculating the redundant portion. I'm wondering if there is a quick and easy way to grab the actually unique values of the distance metric from one of these semi-metric structures, since it sounds like that may be the form it's actually in before constructing the matrix.
*In a related note, Zygote errors for colwise distance calculations but not pairwise for the same reason. This is less urgent, but is there a way to perform the colwise calculation without mutations that break Zygote automatic differentiation?
The text was updated successfully, but these errors were encountered: