I have tried to subclass torch.Tensor, however dtype cannot be param of torch.Tensor.new. I could not find out how to init dtype
Here is what I have tried
def __new__(self, data, stats):
    tensor = torch.as_tensor(data, dtype=torch.long)
    return torch.Tensor.__new__(self, tensor)   # Error: expected Float (got Long)

or like
def __new__(self, data, stats):
    tensor = torch.as_tensor(data, dtype=torch.long)
    return tensor
def __init__(self, data, stats):
    self.stats = stats

x = MyTensor([1,2,3],3)   # Actually it returns a torch.LongTensor not MyTensor object
x.stats   # Error