UniVL icon indicating copy to clipboard operation
UniVL copied to clipboard

TypeError: bad operand type for unary -: 'list'

Open jxrloveyou opened this issue 2 years ago • 6 comments

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)

jxrloveyou avatar Mar 31 '22 12:03 jxrloveyou

Hi @jxrloveyou, what is your NumPy version? The 1.19.5 is ok.

ArrowLuo avatar Apr 01 '22 01:04 ArrowLuo

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.

jxrloveyou avatar Apr 01 '22 07:04 jxrloveyou

oh, I have the same problem, did you solve it? @jxrloveyou

onlyonewater avatar Apr 05 '22 11:04 onlyonewater

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.

ArrowLuo avatar Apr 05 '22 14:04 ArrowLuo

ok, I get it, thanks, @ArrowLuo

onlyonewater avatar Apr 05 '22 16:04 onlyonewater

ok, I get it, thanks, @ArrowLuo

Hi! Do you know how to download the raw videos of YouCook2? Thank you very much!

tiesanguaixia avatar May 20 '23 15:05 tiesanguaixia