• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# mypy: allow-untyped-defs
2import torch
3from torch._C import _ImperativeEngine as ImperativeEngine
4
5
6__all__ = ["VariableMeta", "Variable"]
7
8
9class VariableMeta(type):
10    def __instancecheck__(cls, other):
11        return isinstance(other, torch.Tensor)
12
13
14class Variable(torch._C._LegacyVariableBase, metaclass=VariableMeta):  # type: ignore[misc]
15    _execution_engine = ImperativeEngine()
16