NLP_sentiment_classification icon indicating copy to clipboard operation
NLP_sentiment_classification copied to clipboard

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

Open YunNaYoung opened this issue 5 years ago • 0 comments

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로 바꿔봤는데도 같은 에러가 뜹니다..ㅠㅠㅜ

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

YunNaYoung avatar Apr 25 '19 05:04 YunNaYoung