pytorch/torch/nn/utils/weight_norm.pyi
Jon Malmaud 595e344769 Add type stubs to import 'nn' modules (#22411)
Summary:
Forgot to mirror the `nn/ __init__.py` semantics in the new `nn` type stub.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/22411

Differential Revision: D16149798

Pulled By: ezyang

fbshipit-source-id: 0ffa256fbdc5e5383a7b9c9c3ae61acd11de1dba
2019-07-08 09:22:37 -07:00

29 lines
696 B
Python

from typing import Any, TypeVar
from ..modules import Module
class WeightNorm:
name: str = ...
dim: int = ...
def __init__(self, name: str, dim: int) -> None: ...
# TODO Make return type more specific
def compute_weight(self, module: Module) -> Any: ...
@staticmethod
def apply(module: Module, name: str, dim: int) -> 'WeightNorm': ...
def remove(self, module: Module) -> None: ...
def __call__(self, module: Module, inputs: Any) -> None: ...
T_module = TypeVar('T_module', bound=Module)
def weight_norm(module: T_module, name: str = ..., dim: int = ...) -> T_module: ...
def remove_weight_norm(module: T_module, name: str = ...) -> T_module: ...