mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Fixes https://github.com/pytorch/pytorch/issues/44638 Pull Request resolved: https://github.com/pytorch/pytorch/pull/45004 Reviewed By: VitalyFedyunin Differential Revision: D24113562 Pulled By: ezyang fbshipit-source-id: a85018b7e08b2fe6cf2bc14a217eb418cb2b9de4
17 lines
445 B
Python
17 lines
445 B
Python
import torch
|
|
from torch._six import with_metaclass
|
|
|
|
|
|
class VariableMeta(type):
|
|
def __instancecheck__(cls, other):
|
|
return isinstance(other, torch.Tensor)
|
|
|
|
|
|
# mypy doesn't understand torch._six.with_metaclass
|
|
class Variable(with_metaclass(VariableMeta, torch._C._LegacyVariableBase)): # type: ignore
|
|
pass
|
|
|
|
|
|
from torch._C import _ImperativeEngine as ImperativeEngine
|
|
Variable._execution_engine = ImperativeEngine() # type: ignore
|