Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jxrloveyou opened this issue Mar 31, 2022 · 6 comments
Open

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

jxrloveyou opened this issue Mar 31, 2022 · 6 comments

Comments

@jxrloveyou
Copy link

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)
@ArrowLuo
Copy link
Contributor

ArrowLuo commented Apr 1, 2022

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

@jxrloveyou
Copy link
Author

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.

@onlyonewater
Copy link

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

@ArrowLuo
Copy link
Contributor

ArrowLuo commented Apr 5, 2022

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.

@onlyonewater
Copy link

ok, I get it, thanks, @ArrowLuo

hemanthkumar17 added a commit to hemanthkumar17/UniVL that referenced this issue Mar 22, 2023
@tiesanguaixia
Copy link

ok, I get it, thanks, @ArrowLuo

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants