Skip to content
New issue

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

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

Already on GitHub? # to your account

LSTM 소스에서 질문 있습니다! #2

Open
YunNaYoung opened this issue Apr 25, 2019 · 0 comments
Open

LSTM 소스에서 질문 있습니다! #2

YunNaYoung opened this issue Apr 25, 2019 · 0 comments

Comments

@YunNaYoung
Copy link

YunNaYoung commented Apr 25, 2019

def sort_by_sequence_length(self, x, y, seq_len):
sorted_idx = np.argsort(np.array(seq_len))[::-1]
x = Variable(torch.LongTensor(np.array(x)[sorted_idx]))
y = Variable(torch.LongTensor(np.array(y)[sorted_idx]))
seq_len = Variable(torch.LongTensor(np.array(seq_len)[sorted_idx]))

함수에서 자꾸 아래와 같은 에러가 나는데..
TypeError: can't convert np.ndarray of type numpy.str_. The only supported types are: double, float, float16, int64, int32, and uint8.

해결할 방법이 없을까요..?
numpy to tensor를 하려고 torch.from_numpy로 바꿔봤는데도 같은 에러가 뜹니다..ㅠㅠㅜ

그리고 먼저 올라온 이슈 올린사람과 동일인물인데요.. 앞의 이슈는 지워주실수 있을까요?
감사합니다...ㅜㅜ

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

No branches or pull requests

1 participant