📜  张量到 int python 代码示例

📅  最后修改于: 2022-03-11 14:46:17.951000             🧑  作者: Mango

代码示例1
#in the case the tensor has only one value
int_tensor = torch.IntTensor(3)
int_value = int_tensor.item()
#in the case the tensor has only many values
int_tensor = torch.IntTensor([3,2,1])
list_int_value = int_tensor.tolist()