xcmyz / FastSpeech

The Implementation of FastSpeech based on pytorch.
MIT License
858 stars 213 forks source link

long int 转换成float erro #89

Closed li-xx-5 closed 3 years ago

li-xx-5 commented 4 years ago

RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.cuda.FloatTensor instead (while checking arguments for embedding)

sequence = torch.autograd.Variable( torch.from_numpy(text)).cuda().float() src_pos = torch.autograd.Variable( torch.from_numpy(src_pos)).cuda().float()

when i convert this to float,why i met this erro.

Get Data

            character = torch.from_numpy(
                data_of_batch["text"]).long().to(device)
            mel_target = torch.from_numpy(
                data_of_batch["mel_target"]).float().to(device)
            D = torch.from_numpy(data_of_batch["D"]).int().to(device)
            mel_pos = torch.from_numpy(
                data_of_batch["mel_pos"]).float().to(device)
            src_pos = torch.from_numpy(
                data_of_batch["src_pos"]).float().to(device)
            max_mel_len = data_of_batch["mel_max_len"]