How to modify the tensor class or use custom data type?

Hi All

I want to use custom data type or modify the tensor class to accommodate these custom datatype.
Actually, I need to test the effect of the variable bit width.
For example, I want to replace float with unsigned int a : 3; or something like that.

I think I should modify the tensor class to accommodate these custom data types.
Am I on the right direction? Or Is there other ways to do it more easily?

@111313
I don’t think you can test bit wise datatype. pytorch currently support these types.
https://github.com/pytorch/pytorch/blob/master/c10/core/ScalarType.h#L26