对于元素为浮点数的numpy对象,torch.tensor的类型为torch.float64,而torch.Tensor的类型为torch.FloatTensor。而LSTM要求的类型为torch.FloatTensor。 torch.tensor(np.asarray(c),dtype=torch.float32)