[Apache TVM Discuss] [Questions] Ndarray.h GetDataSize() question

2021-11-16 Thread Eric Kim via Apache TVM Discuss
Oh, I think I see. It's an arithmetic trick to ensure that a dtype where bits<8 will still result in the nbytes-per-element to be 1 byte. --- [Visit Topic](https://discuss.tvm.apache.org/t/ndarray-h-getdatasize-question/11485/2) to respond. You are receiving this because you enabled mail

[Apache TVM Discuss] [Questions] Ndarray.h GetDataSize() question

2021-11-16 Thread Eric Kim via Apache TVM Discuss
In this implementation of `GetDataSize()`: https://github.com/apache/tvm/blob/58716081637fdf21bdae44122086f1dbc35f7c35/include/tvm/runtime/ndarray.h#L316 there is this mysterious line: ``` size *= (arr.dtype.bits * arr.dtype.lanes + 7) / 8; ``` I was instead expecting the simpler: ``` size *=