How to compute the size of Pytorch tensors

It is fairly simple to compute the in memory size of Pytorch tensors with two handy methods: numel and element_size: