UniVL
UniVL copied to clipboard
TypeError: bad operand type for unary -: 'list'
Hello, there is an error at '-x' in the following code, is it a problem with the numpy version?
import numpy as np
def compute_metrics(x):
sx = np.sort(-x, axis=1)
d = np.diag(-x)
Hi @jxrloveyou, what is your NumPy version? The 1.19.5 is ok.
Helo @ArrowLuo, My Numpy version is 1.19.5, I also found that the dimensions of the elements in the list 'x' are not the same, so the np.sort() operation cannot be performed: The dimension of the last element is (41, 3369), others is (64, 3369). The length of list 'x' is 51.
oh, I have the same problem, did you solve it? @jxrloveyou
Hi @onlyonewater, @jxrloveyou, thanks for your attention to this issue. It is indeed a bug for the line #L442. This line will return a list instead of a NumPy array. Refer to L#440 to repair it, i.e., add sim_matrix = np.concatenate(tuple(sim_matrix), axis=0)
after #L442. Thanks.
ok, I get it, thanks, @ArrowLuo
ok, I get it, thanks, @ArrowLuo
Hi! Do you know how to download the raw videos of YouCook2? Thank you very much!