The following code worked before the 1.7.0 update, and now it fails.
@classmethod
def __torch_function__(self, func, types, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
args = [a.tensor() if hasattr(a, 'tensor') else a for a in args]
test = func(*args, **kwargs)
print(test.dtype)
return TestTensor(test.float()) # Fails if the above print statement is commented out.
results in this error message:
25 test = func(*args, **kwargs)
---> 26 print(test.dtype)
27 return TestTensor(test.float())
28 AttributeError: 'torch.Size' object has no attribute 'dtype'
How do I fix this?