variable.py 364 B

1234567891011121314
  1. import torch
  2. from torch._C import _ImperativeEngine as ImperativeEngine
  3. __all__ = ["VariableMeta", "Variable"]
  4. class VariableMeta(type):
  5. def __instancecheck__(cls, other):
  6. return isinstance(other, torch.Tensor)
  7. class Variable(torch._C._LegacyVariableBase, metaclass=VariableMeta): # type: ignore[misc]
  8. _execution_engine = ImperativeEngine()