Hi, I am confused that why torch.tensor is hashable, while list is not hashable?
suppose I have a tensor T = torch.randn(5,5). Then I get its hash value via hash(T), say it is 140676925984200, then assign it to another variable, say c. Below is the code.
T = torch.randn(5,5)
c = hash(T) # i.e. c = 140676925984200
dic = dict()
dic[T] = 100
dic[c]
The last line caused an error:
RuntimeError: bool value of Tensor with more than one value is ambiguous.
Obviously,
hash(c) == hash(T)