add dynamic isinstance (#26269)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26269
previously isinstance only worked when we could statically determine
if it were true/false. Now we actually can issue an isinstance check
in case where it is dependent on the runtime type, e.g. Optional[int]
being an instance of int. This is not very useful on its own yet,
but with type refinement and allowing Any as an argument type this will
allow for python-style "overloaded" functions such that we can
remove our __overload__ support.
Test Plan: Imported from OSS
Differential Revision: D17412853
Pulled By: zdevito
fbshipit-source-id: e2c37040f25f6b94ee1676854fceecd22de190ef