Closed wyupupup closed 2 years ago
Can you provide a minimal example to reproduce this issue? I will inspect it. Thank you!
Thanks for your reply, my example code is as follows: `import pygmtools as pygm import numpy as np
M = [[ [1, 0, 0, 1, 0, 0.1], [0, 0.1, 1, 0, 0.1, 0], [0, 1, 0.2, 0, 0, 0], [1, 0, 0, 1, 0, 0], [0, 0.1, 0, 0, 0.1, 0], [0.1, 0, 0, 0, 0, 0.1]]] pygm.BACKEND = 'numpy' M = np.array(M) n1 = np.array([2]) n2 = np.array([3])
X = pygm.rrwm(M, n1, n2)
print(pygm.hungarian(X))`
I have done a bug fix and published 0.2.1, and your reported issue shall be fixed.
Please upgrade your pygmtools by pip install --upgrade pygmtools
Problem solved, thanks a lot!
When the batchsize of the affinity matrix K I input is 1, I get the following error:ValueError: Invalid norm order 'fro' for vectors. I observed the rrwm function in numpy_backend.py and found the following code(on line 162):
if np.linalg.norm((v - last_v).squeeze(), ord='fro') < 1e-5:
. When batchsize is 1, due to the existence of thesqueeze()
function,v - last_v
will become a vector form, but when the value of the parameterord
of thenp.linalg.norm()
function is 'fro', thenp.linalg.norm()
function can only act on matrices, which leads to the above error. I think it is more appropriate when the value of the parameterord
is None, then thenp.linalg.norm()
function can work on matrices or vectors.