mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18181 ghimport-source-id: 9c23551584a1a1b0b7ac246367f3a7ae1c50b315 Stack from [ghstack](https://github.com/ezyang/ghstack): * #18184 Fix B903 lint: save memory for data classes with slots/namedtuple * **#18181 Fix B902 lint error: invalid first argument.** * #18178 Fix B006 lint errors: using mutable structure in default argument. * #18177 Fix lstrip bug revealed by B005 lint A variety of sins were committed: - Some code was dead - Some code was actually a staticmethod - Some code just named it the wrong way - Some code was purposely testing the omitted case Signed-off-by: Edward Z. Yang <ezyang@fb.com> Differential Revision: D14530876 fbshipit-source-id: 292a371d9a76ddc7bfcfd38b6f0da9165290a58e
16 lines
361 B
Python
16 lines
361 B
Python
import torch
|
|
from torch._six import with_metaclass
|
|
|
|
|
|
class VariableMeta(type):
|
|
def __instancecheck__(cls, other):
|
|
return isinstance(other, torch.Tensor)
|
|
|
|
|
|
class Variable(with_metaclass(VariableMeta, torch._C._LegacyVariableBase)):
|
|
pass
|
|
|
|
|
|
from torch._C import _ImperativeEngine as ImperativeEngine
|
|
Variable._execution_engine = ImperativeEngine()
|