mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
don't return in __init__ functions (#60830)
Summary: Fix some warnings from a code analyzer Pull Request resolved: https://github.com/pytorch/pytorch/pull/60830 Reviewed By: jbschlosser Differential Revision: D29433638 Pulled By: albanD fbshipit-source-id: 148df1d8a0a79778f18e8b6abffbddef36c5031c
This commit is contained in:
parent
9af8aecd00
commit
cadce14e02
|
|
@ -99,7 +99,7 @@ class FunctionMeta(type):
|
||||||
backward_fn = type(name + 'Backward', (BackwardCFunction,), {'_forward_cls': cls})
|
backward_fn = type(name + 'Backward', (BackwardCFunction,), {'_forward_cls': cls})
|
||||||
cls._backward_cls = backward_fn
|
cls._backward_cls = backward_fn
|
||||||
|
|
||||||
return super(FunctionMeta, cls).__init__(name, bases, attrs)
|
super(FunctionMeta, cls).__init__(name, bases, attrs)
|
||||||
|
|
||||||
|
|
||||||
# mypy doesn't understand `with_metaclass` from torch._six
|
# mypy doesn't understand `with_metaclass` from torch._six
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class ProxyableClassMeta(type):
|
||||||
"""
|
"""
|
||||||
def __init__(cls, name, bases, attrs):
|
def __init__(cls, name, bases, attrs):
|
||||||
_proxyable_classes.setdefault(cls)
|
_proxyable_classes.setdefault(cls)
|
||||||
return super().__init__(name, bases, attrs)
|
super().__init__(name, bases, attrs)
|
||||||
|
|
||||||
def __call__(cls, *args, **kwargs):
|
def __call__(cls, *args, **kwargs):
|
||||||
instance = cls.__new__(cls) # type: ignore[call-overload]
|
instance = cls.__new__(cls) # type: ignore[call-overload]
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ class ScriptMeta(type):
|
||||||
delattr(self, name)
|
delattr(self, name)
|
||||||
|
|
||||||
cls.__init__ = init_then_script # type: ignore[misc]
|
cls.__init__ = init_then_script # type: ignore[misc]
|
||||||
return super(ScriptMeta, cls).__init__(name, bases, attrs)
|
super(ScriptMeta, cls).__init__(name, bases, attrs)
|
||||||
|
|
||||||
|
|
||||||
class _CachedForward(object):
|
class _CachedForward(object):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user