xref: /aosp_15_r20/external/pytorch/torch/autograd/variable.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
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