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
Don’t use torch.LongTensor, it’s not a proper class/type but a hack!
The proper thing is to subclass Tensor and have the dtype set fixed to torch.long.
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