I’m not sure if there’s a better option out there, but structured kernels 2 (and specifically meta tensors) might help with this a bit. If you construct meta tensors and pass them to an aten op, the returned tensor will have the correct size/dtype, but without any actual data allocation / computation being performed.
e.g.:
a = torch.ones(2, device='meta', dtype=torch.int32)
b = torch.ones(2, device='meta', dtype=torch.int64)
c = a + b # returns a meta tensor with correct output size / dtype, no actual computation is performed.
c.dtype # torch.int64

The wrinkle is that only operators that have been ported to structured support meta tensors, so if your goal is to use this for 100% of ops then this won’t work in the near term. There’s an open issue with a running list of supported/unsupported ops here 1.