Files
pytorch/torch/nn/parameter.pyi
PyTorch MergeBot 2db28a9611 Revert "[BE]: Update Typeguard to TypeIs for better type inference (#133814)"
This reverts commit bce0caba7804b0787684dbf1f4e1c4d9e3acded5.

Reverted https://github.com/pytorch/pytorch/pull/133814 on behalf of https://github.com/ezyang due to root cause of internal failures not addressed ([comment](https://github.com/pytorch/pytorch/pull/133814#issuecomment-2302466444))
2024-08-21 16:13:34 +00:00

45 lines
1.1 KiB
Python

# mypy: allow-untyped-defs
from typing_extensions import TypeGuard
from torch import device, dtype, Tensor
class Parameter(Tensor):
def __init__(self, data: Tensor = ..., requires_grad: bool = ...) -> None: ...
def is_lazy(
param: Tensor,
) -> TypeGuard[UninitializedParameter | UninitializedBuffer]: ...
class UninitializedParameter(Tensor):
def __init__(self, data: Tensor = ..., requires_grad: bool = ...) -> None: ...
def materialize(
self,
shape: tuple[int, ...],
device: device | None = None,
dtype: dtype | None = None,
) -> None: ...
class Buffer(Tensor):
persistent: bool
def __init__(
self,
data: Tensor = ...,
requires_grad: bool = ...,
persistent: bool = ...,
): ...
class UninitializedBuffer(Tensor):
persistent: bool
def __init__(
self,
data: Tensor = ...,
requires_grad: bool = ...,
persistent: bool = ...,
): ...
def materialize(
self,
shape: tuple[int, ...],
device: device | None = None,
dtype: dtype | None = None,
) -> None: ...