variable.py 433 B

1234567891011121314
  1. import torch
  2. from torch._six import with_metaclass
  3. class VariableMeta(type):
  4. def __instancecheck__(cls, other):
  5. return isinstance(other, torch.Tensor)
  6. # mypy doesn't understand torch._six.with_metaclass
  7. class Variable(with_metaclass(VariableMeta, torch._C._LegacyVariableBase)): # type: ignore[misc]
  8. pass
  9. from torch._C import _ImperativeEngine as ImperativeEngine
  10. Variable._execution_engine = ImperativeEngine()