In Pytorch, if I have a 2D tensor, how to iterate over this tensor to get every value changed

datascience.stackexchange https://datascience.stackexchange.com/questions/44682

  •  01-11-2019
  •  | 
  •  

Question

I have a 2d Tensor, whose size is 1024x1024 and the values in the tensor is 0.3333, 0.6667, and 1.0000, so I would like to change all these values to 0,1,2.

Could some one tell me how to iterate over this tensor.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top