Closed
Description
🚀 Feature
Add nbytes
and itemsize
methods to Tensor. It has the same semantics as https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.ndarray.nbytes.html and https://docs.scipy.org/doc/numpy-1.15.0/reference/generated/numpy.ndarray.itemsize.html (though, in keeping with PyTorch style, it is a function call, not a property).
Motivation
The primary motivation is that caffe2::Tensor has these two methods, it's used somewhat frequently in the Caffe2 codebase, and it seems like a generally useful thing to have around.
Alternatives
- Don't add them, and make users do the computation themselves. This might be a little annoying to do, because if we don't have
itemsize()
the user has to compute it themselves from the dtype.