python list转tensor

就自己做个记录

import numpy as np

neg_list = []
neg_numpy = np.array(neg_list)
neg_tensor = torch.from_numpy(neg_numpy)