swap isinstance(t, FakeTensor) to is_fake (#188978)
Summary:
closed #188694 bc need to stack smth on top copying pr summary over...
in preparation for C++ FakeTensor migration, i am landing this change first to change isinstance(t, FakeTensor) to is_fake_tensor and adding a check for C++ FakeTensor to the is_fake_tensor function. but since C++ faketensor is not being used yet this PR should be a no-op
most loc should be converting isinstance(t, FakeTensor) to is_fake_tensor(t)
is_fake_tensor is defined in fake_tensor.py and is now the base case for the is_fake() recursive function
for attributes like fake_device, real_tensor, constant, C++ will access them differently via a pybind function to expose, so i made helper functions to wrap that logic. for now, C++ path returns None
also added a lint rule ISINSTANCE_FAKE_TENSOR to prevent future uses of isinstance(t, FakeTensor) unless you actually want to check for Python FakeTensor specifically (ie in fake_tensor.py) but this should be removed after C++ FakeTensor fully takes over
X-link: https://github.com/pytorch/pytorch/pull/188978
Approved by: https://github.com/zou3519
Reviewed By: jeanschmidt
Differential Revision: D111922070
fbshipit-source-id: c7e3ddae244897de008e599cd4441c21cf3aaced