Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

tensor to int python

#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()
 
PREVIOUS NEXT
Tagged: #tensor #int #python
ADD COMMENT
Topic
Name
3+8 =