ValueError: only one element tensors can be converted to Python scalars的错误。原因是:要转换的list里面的元素包含多维的tensor。
ValueError: only one element tensors can be converted to Python scalars
val= torch.tensor([item.cpu().detach().numpy() for item in val]).cuda()