Have __sizeof__ account for size of stored elements#3821
Have __sizeof__ account for size of stored elements#3821ezyang merged 2 commits intopytorch:masterfrom
Conversation
|
This includes the size of the Storage in the tensor, but the documentation for sizeof says: That means that the recipe for computing memory referenced in the Python documentation will overstate the memory usage: https://code.activestate.com/recipes/577504/ I don't think this will change the code snippet from the original PyTorch discussion either:
|
|
On the other hand, perhaps including the |
|
Thank you @colesbury. I'm good with sticking to the specification. |
|
Done |
* Have __sizeof__ account for size of stored elements * Conform to sizeof specification
* Have __sizeof__ account for size of stored elements * Conform to sizeof specification
This PR addresses #3655.
__sizeof__now accounts for the size of data inTensoras well asStorage:Note that the reported size is indicative: it only accounts for the size of the data and disregards other attributes (e.g.
Size).