mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Related to https://github.com/pytorch/pytorch/issues/40397 Inspired by ezyang's comment at https://github.com/pytorch/pytorch/issues/40397#issuecomment-648233001, this PR attempts to leverage using `__all__` to explicitly export private functions from `_VariableFunctions.pyi` in order to make `mypy` aware of them after: ``` if False: from torch._C._VariableFunctions import * ``` The generation of the `__all__` template variable excludes some items from `unsorted_function_hints`, as it seems that those without hints end up not being explicitly included in the `.pyi` file: I leaned on the side of caution and opted for having `__all__` consistent with the definitions inside the file. Additionally, added some pretty-printing to avoid having an extremely long line. Pull Request resolved: https://github.com/pytorch/pytorch/pull/40499 Differential Revision: D22240716 Pulled By: ezyang fbshipit-source-id: 77718752577a82b1e8715e666a8a2118a9d3a1cf
17 lines
443 B
Python
17 lines
443 B
Python
# ${generated_comment}
|
|
|
|
from torch import Tensor, Generator, strided, memory_format, contiguous_format
|
|
from typing import List, Tuple, Optional, Union, Any, ContextManager, Callable, overload, Iterator, NamedTuple, Sequence, TypeVar
|
|
from torch._six import inf
|
|
|
|
from torch.types import _int, _float, _bool, Number, _dtype, _device, _qscheme, _size, _layout
|
|
|
|
import builtins
|
|
|
|
# REDUNDANT!
|
|
${namedtuple_defs}
|
|
|
|
${function_hints}
|
|
|
|
${all_directive}
|