Related to Subclassing torch.Tensor 4
But I am trying to extend tensor with dtype=torch.int64
My code like this:
class MyTensor(torch.LongTensor):
    @staticmethod
    def __new__(cls, data, stats, *args, **kwargs):
        return super().__new__(cls, data, *args, **kwargs)
    def __init(self, stats, *args, **kwargs):
        self._stats = stats

x = MyTensor([0,1,2], 3)

This works for subclassing torch.Tensor, however it not work for torch.LongTensor
TypeError: type ‘torch.LongTensor’ is not an acceptable base type
How to subclass torch.LongTensor