1*da0073e9SAndroid Build Coastguard Worker# mypy: allow-untyped-defs 2*da0073e9SAndroid Build Coastguard Workerimport torch 3*da0073e9SAndroid Build Coastguard Workerfrom torch._C import _ImperativeEngine as ImperativeEngine 4*da0073e9SAndroid Build Coastguard Worker 5*da0073e9SAndroid Build Coastguard Worker 6*da0073e9SAndroid Build Coastguard Worker__all__ = ["VariableMeta", "Variable"] 7*da0073e9SAndroid Build Coastguard Worker 8*da0073e9SAndroid Build Coastguard Worker 9*da0073e9SAndroid Build Coastguard Workerclass VariableMeta(type): 10*da0073e9SAndroid Build Coastguard Worker def __instancecheck__(cls, other): 11*da0073e9SAndroid Build Coastguard Worker return isinstance(other, torch.Tensor) 12*da0073e9SAndroid Build Coastguard Worker 13*da0073e9SAndroid Build Coastguard Worker 14*da0073e9SAndroid Build Coastguard Workerclass Variable(torch._C._LegacyVariableBase, metaclass=VariableMeta): # type: ignore[misc] 15*da0073e9SAndroid Build Coastguard Worker _execution_engine = ImperativeEngine() 16